i was wondering if there is a git command to see if a specific commit is in the current working tree. I have the shasign of the specific commit. I like to know if this commit is a commit done by another user in another working tree or if it’s commit which is newer then the current HEAD of my working tree.
The reason i want to do this is, because we have a Jenkins server set up and there are builds done regularly, but i want to test the latest build to see if it’s the same as my HEAD, or if it’s an older commit, or if it’s a commit done by someone else.
I think by “in the current working tree” you must mean “in the history of HEAD”.
To do the tests you describe, given the SHA1sum
S, you can do the following:Sis the same as yourHEAD, comparegit rev-parse --verify Swithgit rev-parse --verify HEADHEAD, you can comparegit merge-base S HEADwithgit rev-parse --verify S. If they are the same, thenSis an ancestor ofHEAD.git show -s --pretty='%an <%ae>' HEADandgit show -s --pretty='%an <%ae>' S