1弓柱、創(chuàng)建本地分支 local_branch
git branch local_branch
2沟堡、創(chuàng)建本地分支local_branch 并切換到local_branch分支
git checkout -b local_branch
3、切換到分支local_branch
git checkout local_branch
4矢空、推送本地分支local_branch到遠(yuǎn)程分支 remote_branch并建立關(guān)聯(lián)關(guān)系
a.遠(yuǎn)程已有remote_branch分支并且已經(jīng)關(guān)聯(lián)本地分支local_branch且本地已經(jīng)切換到local_branch
git push
b.遠(yuǎn)程已有remote_branch分支但未關(guān)聯(lián)本地分支local_branch且本地已經(jīng)切換到local_branch
git push -u origin/remote_branch
c.遠(yuǎn)程沒有有remote_branch分支并航罗,本地已經(jīng)切換到local_branch
git push origin local_branch:remote_branch
5、刪除本地分支local_branch
git branch -d local_branch
6屁药、刪除遠(yuǎn)程分支remote_branch
git push origin? :remote_branch
git branch -m | -M oldbranch newbranch 重命名分支粥血,如果newbranch名字分支已經(jīng)存在,則需要使用-M強(qiáng)制重命名酿箭,否則复亏,使用-m進(jìn)行重命名。
git branch -d | -D branchname 刪除branchname分支
git branch -d -r branchname 刪除遠(yuǎn)程branchname分支
7缭嫡、查看本地分支
git branch
8缔御、查看遠(yuǎn)程和本地分支
git branch -a