Git 使用及原理 總結


1.  $git diff origin/master master (show me the changes between the remote master branch and my master branch).

  需要注意的是,remotes/origin/master和origin/master的指向是相同的

2.  $git diff origin/master remotes/origin/master

3.  $git push origin master

  origin指定了你要push到哪個remote

  master其實是一個“refspec”,正常的“refspec”的形式為”+<src>:<dst>”,冒號前表示local branch的名字,冒號后表示remote repository下 branch的名字。

  注意,如果你省略了<dst>,git就認為你想push到remote repository下和local branch相同名字的branch。

  push就是把本地branch指向的commit push到remote repository下的branch,

  比如 $git push origin master:master (在local repository中找到名字為master的branch,使用它去更新remote repository下名字為master的branch,

  如果remote repository下不存在名字是master的branch,那么新建一個)

4.  $git push origin master (省略了<dst>,等價於“git push origin master:master”)

5.  $git push origin master:refs/for/mybranch (在local repository中找到名字為master的branch,用他去更新remote repository下面名字為mybranch的branch)

6.  $git push origin HEAD:refs/for/mybranch (HEAD指向當前工作的branch,master不一定指向當前工作的branch,所以我覺得用HEAD還比master好些)

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

8.  $git blame <file>

參考:

  http://blog.csdn.net/abo8888882006/article/details/12375091


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM