简体   繁体   English

如何在主分支中获取最新提交的修订号

[英]How to get revision number of latest commit in master branch

I am trying to find a command which can help me find the "revision" number of origin/master .我正在尝试找到一个可以帮助我找到origin/master的“修订”号的命令。 the command should be able to find the revision from any branch which is currently checked out.该命令应该能够从当前签出的任何分支中找到修订。

Assuming that i am in git rev-list --max-count=1 HEAD --remotes=master .假设我在git rev-list --max-count=1 HEAD --remotes=master But it didn't give me "Correct" revision number.但它没有给我“正确”的修订号。 It gave me a revision number which was 3-4 commits behind.它给了我一个修订号,落后了 3-4 个提交。 So not sure if it fetched that from master or from local.所以不确定它是从master还是从本地获取的。

You mean, revision id?你的意思是,修订ID?

git rev-parse HEAD

Not sure about a git command, but cat.git/refs/remotes/origin/master will get you commit hash of origin/master.不确定 git 命令,但cat.git/refs/remotes/origin/master会让你提交原点/主控的 hash。

Per Ulysse BN's comment, the corresponding git command would be git rev-parse origin/master根据 Ulysse BN 的评论,相应的 git 命令将是git rev-parse origin/master

You can show additional information with git show origin/master or git log -1 origin/master您可以使用git show origin/mastergit log -1 origin/master来显示其他信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM