zoukankan      html  css  js  c++  java
  • 偶尔要用的git命令备忘

    文档:https://git-scm.com/docs

    列出所有远程空间:

    git remote -v

    重命名远程空间:

    git remote rename <old> <new>

    删除远程空间:

    git remote remove <name>

    列出所有分支(本地+远程):

    git branch -a

    查看本地与远程分支对应关系:

    git branch -vv

    关联本地与远程分支:

    git branch -u <远程空间/远程分支> [<本地分支>]

    当远程空间刚刚建立,没有分支时,push出一个并建立关联:

    git push -u <远程空间> <远程分支>

    修改首个提交:

    git checkout --orphan new_master #新建一个干净的临时分支
    # 添加文件
    git commit -m "new initial commit" #提交。这应当是我们期望的首次提交的样子
    git checkout master #切换到想修改的分支
    git reset --hard new_master #使它变得与临时分支一模一样
    git branch -D new_master #删除临时分支
  • 相关阅读:
    ACM-ICPC 2018 南京赛区网络预赛 J.Sum
    汉诺塔
    汉诺塔
    D
    D
    数学小定理
    数学小定理
    Python index()方法
    Python endswith()方法
    Python encode()方法
  • 原文地址:https://www.cnblogs.com/ahdung/p/11498162.html
Copyright © 2011-2022 走看看