git push 總結

轉自 https://blog.csdn.net/wh_19910525/article/details/7438183  感謝作者


$ git push ssh://[email protected]/rt4ls.git master // 把本地倉庫提交到遠程倉庫的master分支中


$ git remote add origin ssh://[email protected]/rt4ls.git
$ git push origin master 


這兩個操作是等價的,第二個操作的第一行的意思是添加一個標記,讓origin指向ssh://[email protected]/rt4ls.git,也就是說你操 作origin的時候,實際上就是在操作ssh://[email protected]/rt4ls.git。origin在這裏完全可以理解爲後者 的別名。

    注意:需要說明的是,默認情況下 這條語句等價於提交 本地的master分支,到遠程倉庫,並作爲遠程的master分支。
    如果想把 本地的某個分支test 提交到 遠程倉庫,並作爲遠程倉庫的master分支,或者 作爲另外一個名叫test的分支,那麼可以這麼做。

$ git push origin test:master         // 提交本地test分支 作爲 遠程的master分支
$ git push origin test:test              // 提交本地test分支作爲遠程的test分支

如果想刪除遠程的分支呢?類似於上面,如果:左邊的分支爲空,那麼將刪除:右邊的遠程的分支


git push origin :test              // 剛提交到遠程的test將被刪除,但是本地還會保存的,不用擔心。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章