git rev-parse介紹;獲取commit id


git rev-parse master^{commit} 是什么意思

顯示master提交的SHA1值

if you want to make sure that the output actually names an object in your object database and/or can be used as a specific type of object you require, you can add the ^{type} peeling operator to the parameter. For example, git rev-parse "$VAR^{commit}" will make sure $VAR names an existing object that is a commit-ish (i.e. a commit, or an annotated tag that points at a commit). To make sure that $VAR names an existing object of any type, git rev-parse "$VAR^{object}" can be used.

git rev-parse –-git-dir

顯示版本庫.git目錄所在的位置

git rev-parse –-show-toplevel

顯示工作區根目錄

git rev-parse –-show-prefix

顯示相對於工作區根目錄的相對路徑

git rev-parse –-show-cdup

顯示從當前目錄(cd)后退(up)到工作區的根目錄的深度

git rev-parse --symbolic –-branches

https://git-scm.com/docs/git-rev-parse

show branch refs found in refs/heads/

git rev-parse –-symbolic –-tags

獲取完整commit id(如:bb4f92a7d4cbafb67d259edea5a1fa2dd6b4cc7a)

git rev-parse HEAD

獲取short commit id(如:bb4f92a)

git rev-parse --short HEAD

這里的rev應該是revision(修訂/版本)的縮寫

show tag refs found in refs/tags/


免責聲明!

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



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