简体   繁体   中英

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 . 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 . But it didn't give me "Correct" revision number. It gave me a revision number which was 3-4 commits behind. So not sure if it fetched that from master or from local.

You mean, revision 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.

Per Ulysse BN's comment, the corresponding git command would be git rev-parse origin/master

You can show additional information with git show origin/master or git log -1 origin/master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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