Using the git diff --shortstat my_branch master
is a great way to tell how many files changes and the insertions and deletions. I read the git diff documentation, but I couldn't find a way to tell the number of commits between my_branch
and master
. Does that exist?
In order to see the commit differences between two branches, use the “git log” command and specify the branches that you want to compare. Note that this command won't show you the actual file differences between the two branches but only the commits.
Show activity on this post. This gives me an exact count of commits in the current branch having its base on master. The command in Peter's answer, git rev-list --count HEAD ^develop includes many more commits, 678 vs 97 on my current project.
Merge branches Merging your branch into master is the most common way to do this. Git creates a new commit (M) that is referred to as a merge commit that results from combining the changes from your feature branch and master from the point where the two branches diverged.
I think you could try:
git log --oneline mybranch ^master
For the exact count:
git log --oneline mybranch ^master | wc -l
Should give you the information you want.
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