Branch 的使用
$ git branch #查看本地分支
$ git branch -r #查看遠(yuǎn)程分支
$ git branch -a #查看所有分支
$ git branch -vv #查看本地分支關(guān)聯(lián)的遠(yuǎn)程分支
$ git branch br_name #創(chuàng)建本地分支
$ git branch -d br_name #刪除本地分支
$ git push --delete origin br_name刪除遠(yuǎn)程分支
$ git checkout -b branch_name origin/br_name創(chuàng)建對應(yīng)遠(yuǎn)程分支的本地分支
$ git branch -m old_branch new_branch # 重命名分支
*重命名遠(yuǎn)程分支,就是先刪除遠(yuǎn)程分支,再重命名本地分支,最后提交一個遠(yuǎn)程分支
$ git push --set-upstream origin new_branch 或 git push -u origin new_branch 創(chuàng)建新的遠(yuǎn)程分支,并將本地分支與遠(yuǎn)程分支建立關(guān)聯(lián)(To push the current branch and set the remote as upstream)
remote命令跟蹤多個遠(yuǎn)程分支
重新跟蹤遠(yuǎn)程文件直接修改
$ git remote origin set-url URL
先刪除再添加
刪除 $ git remote rm origin
前面帶*號的代表你當(dāng)前工作目錄所處的分支