AhDung

/*追求代码质量的野生码农*/

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

列出所有远程空间:

git remote -v

添加远程仓库(空间):

git remote add <name> <url>

重命名远程空间:

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 "first commit" #提交。这应当是我们期望的首次提交的样子
git checkout master #切换到想修改的分支
git reset --hard new_master #使它变得与临时分支一模一样
git branch -D new_master #删除临时分支

 

posted on 2019-09-10 16:22  ahdung  阅读(300)  评论(0编辑  收藏  举报