简体   繁体   English

Git Hash 最后一次未推送的本地提交的值

[英]Git Hash value of last un-pushed local commit

I have 3 local commits on my branch mainline which are ahead of the remote repo.我的分支主线上有 3 个本地提交,位于远程仓库之前。 How to get the hash value of the earliest local commit?如何获取最早本地commit的hash值?

Example:例子:

A <- HEAD(mainline) local A <- HEAD(主线)本地
B
C C
D <- origin/mainline synced with remote D <- 与远程同步的原始/主线

How to get hash value of commit C?如何获取提交 C 的 hash 值?

git log --pretty=%H origin/master..HEAD |tail -n1

You could use git log with a pretty format :您可以使用具有漂亮格式的git log

git log -1 --pretty=format:"%H" origin/mainline

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

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