Git命令小記
分支
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分支
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
Git具體教程
由于具體教程在這兩篇文章中已詳細(xì)陳述,在這就不贅述乐尊!感謝兩位作者