git branch
,*号表示当前所在分支;git branch -v
;git branch -vv
,可以查看上流分支的名字;
git branch -r
,-r就是-remote;
git branch -a
,-a就是-all;
git branch [branch_name]
,但依然停留在当前分支;
git checkout -b [branch_name]
,并切换到该分支;
git push origin [branch_name]:[remote_branch_name]
git push origin master:mybranch1
git branch -m [old_branch_name] [new_branch_name]
git branch -d [branch_name]
,当删除分支是当前所在分支时,需要事先切换到其它分支
git push origin :[remote_branch_name]
git push origin --delete [remote_branch_name]
``
git checkout [branch_name]
;
git branch --set-upstream-to=[remote_branch_name] [branch_name]
git checkout -b res1
git push origin res1:r_res1
git branch --set-upstream-to=origin/r_res1 res1
git branch -vv
git add
git commit -m
需要注意的是,因为此时的本地分支名与远程库分支名不一致,因此需要使用特别的代码
git push origin HEAD:r_res1
git push
就可以了原文:https://www.cnblogs.com/Syinho/p/14210576.html