gitgit-commitgit-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. How to get the hash value of the earliest local commit?

Example:

A <- HEAD(mainline) local
B
C
D <- origin/mainline synced with remote

How to get hash value of commit C?


Solution

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