git學習:關於origin和master

【轉自】http://www.cnblogs.com/mashiqi/p/6002671.html

這篇文章對git push origin master命令講解的比較簡單、形象,轉載記錄下,便於忘記時查閱。

git的服務器端(remote)端包含多個repository,每個repository可以理解爲一個項目。而每個repository下有多個branch,此處各個branch的意義,可以參考這篇文章。"origin"就是指向某一個repository的指針。服務器端的"master"(強調服務器端是因爲本地端也有master)就是指向某個repository的一個branch的指針。

這是服務器端(remote)的情況:

 

而在本地電腦(local)上:"master"就是指向剛剛從remote server傳到本地的副本branch。

 

$git push A B:C     %其中A和C是分別remote端的一個repository的名字和branch的名字,B是本地端branch的名字

的意思是把本地的B推送到remotes/A/C下。當B=C時可以直接省略爲:git push A B。比如:

"git push origin master:master" 可以直接省略爲"git push origin master".


發佈了6 篇原創文章 · 獲贊 7 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章