创建新分支
git branch newbranch
或
git checkout -b newbranch 创建并切换到新分支展示分支
git branch
切换分支
git checkout newbranch
推送本地新建分支到远端分支(远端会自动创建分支)
git push origin newbranch:originbranch
删除远端分支
git push origin :originbranch
拉取远程分支到本地
git fetch origin 远程分支名x:本地分支名x
(
个人使用经历:此语句会自动创建分支,但是必须指定本地分支名,否则则拉取分支失败
)
git branch --set-upstream-to=origin/XXX XXX 建立分支之间的跟踪关系
- 修改分支名并推到远端
git branch -m old_branch new_branch
# Rename branch locally
git push origin :old_branch# Delete the old branch
git push –set-upstream origin new_branch# Push the new branch, set local branch to track the new remote