假如远程分支地址:
https://xxxxxxx/wangdong/helloworld.git
将本地关联到远程
1.git remote add origin https://xxxxxxx/wangdong/helloworld.git
2.git push -u origin master
取消关联远程分支
git remote remove origin
查看与远端分支关联的状态
git remote -v
查看本地分支与远端分支的关联状态
git branch -vv
删除远程的foo 分支
git push --delete origin foo 或 git push origin :foo
删除本地foo 分支
git branch -D foo
回退到指定版本
1.git reset --hard xxxxxxxxxxxxxxxxxxxxx(xxxxxxxxx是commit的时候的版本号) 2.git push -f 将远程仓库也回退回去
远程分支合并本地某个分支
1.本地某个分支需要先commit,获得一个hash串 2.远程分支 git cherry-pick新分支就可以了
git 建立本地分支和远端分支的映射关系
git branch --set-upstream-to origin/远程分支名 本地分支名 比如:git branch --set-upstream-to origin/release/v1.1 release/v1.1