Question:
In following example tree:
1 2 3 4 |
A-B-C-D-E (master branch) \ F-G-H (xxx branch) |
I’m looking for F – the first commit in xxx branch. I think that it is possible with:
1 2 |
git log xxx --not master |
and the last listed commit should be F. Is it correct solution or maybe there are some disadvantages of it?
I know that there were similar questions on stackoverflow, but nobody proposed such solution, and I’m not sure if I do it right.
Answer:
1 2 |
git log master..branch --oneline | tail -1 |
Where “branch” is your specific branch name. The dot-dot gives you all of the commits that the branch has that master doesn’t have.
tail -1
returns the last line from the previous output.