In following example tree:
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:
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.
Git rev-list will list commits in one branch that are not in another branch. It is a great tool when you're trying to figure out if code has been merged into a branch or not. Using the --oneline option will display the title of each commit.
You can just reverse your log and just head it for the first result. git log --reverse reverses the history, so you have to use head -1 instead of tail -1 to get the first commit.
If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .
The first commit that a developer makes when they start a new software project is called the initial commit.
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.
You should use the merge-base
functionality which is designed to solve exactly this:
git merge-base remotes/origin/<branch> develop
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With