Our teams tend to not keep track of how many commits they are behind the latest released code. We want to notify them of that, but getting the information is the hard part, the notify part is done.
What I would like to understand how to pull the git log down, do a git command that outputs "Branch x is behind branch y by 5 commits". I don't want to have to checkout the branch as it pulls down our 600mb+ repo each time for all of our branches, plus I'm running low on drive space. I have found similar questions on stack overflow that reference bash scripts that only work locally, or the ones that point to remote return blank. I'm still learning git and bash, please bear with me.
What you need is git rev-list
(reverse chronological order of commits).
After cloning a repo (make sure the remote is set and git fetch origin
has been performed), to get ahead number of the branch from master, try
git rev-list origin/master..origin/feature/SuperCoolBranch --count
switch the branches around to find out the behind number.
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