How to check the current commit id, a particular branch of a cloned repository is currently on from the terminal
I need to check the current commit id wrt a particular branch of a cloned repository from the terminal.
I need this to merge a commit of a particular branch(say branch 1) with another branch(say branch 2).
Fetching the current commit wrt branch2 would help me to be updated on whats my current p开发者_C百科osition wrt this branch. I can thus go about merging accordingly.
UPDATED
I just want a "command" which would reflect the current commit id I am on for a specific branch. This would for e.g. help me find out if I have done a revert in the "same" branch to an older commit, I can check how many such commits I am behind by wrt the latest commit..
Thank you..
The git show-branch command will describe the divergence of your branches. If you are on branch1, and branch2 has some unmerged commits, it will show them to you.
Your question is confused, but I guess you are looking for the gitk
command. It will show you the revision tree starting from specified points.
gitk --all # Complete history starting from all refs
gitk ref1 # History leading to ref1
gitk ref1 ref2 # History leading to ref1 and ref2
gitk ref1 ^ref2 # History leading to ref1 since it diverged from ref2
gitk ref2..ref1 # Ditto
gitk ref1...ref2 # History of ref1 and ref2 since they diverged
oh, and in the ..
and ...
form, nothing is HEAD, so
gitk ..ref # What is in ref that I didn't merge to me yet
gitk ref.. # What I have that I didn't push to ref yet
gitk ...ref # What is my relation to ref
精彩评论