origin master 和 master,以及 push 命令


 

$ git branch -a (展示所有的git分支)

* master

  remotes/origin/HEAD -> origin/master

  remotes/origin/master

    ······

$ git branch -r (展示遠程分支)

  origin/HEAD -> origin/master

  origin/master

 

可以發現,master就是local branch,origin/master是remote branch

$ git diff origin/master master (可以看到兩者的不同)


git push origin master (省略了<dst>,等價於“git push origin master:master”,其中origin指定了你要push到哪個remote)


我們一般寫的形式爲“ git push origin <src>:<dst> ”,冒號前表示local branch的名字,冒號後表示remote repository下 branch的名字。注意,如果你省略了<dst>,git就認爲你想push到remote repository下和local branch相同名字的branch。


$ git push origin :mybranch (在origin repository裏面查找mybranch,刪除它。用一個空的去更新它,就相當於刪除了)


#刷新遠程分支列表

git remote update origin --prune


 

參考自:http://lishicongli.blog.163.com/blog/static/1468259020132125247302/



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章