On the current branch, we can run this command:
git checkout
to obtain a useful message informing us, "Your branch is ahead of upstream by N commits."
How can an analogous message be obtained for a different branch?
(Needless to say, without switching to that branch first?)
(Also, without doing some hacky text filtering, like generating a log of the local commits, counting them with wc
and then faking out the message; that is, is there a direct way inside the git executable?)
Fictitious example:
$ git <magic-incantation> foo-branch
Branch foo-branch is ahead of origin/foo-branch by 17 commits.
What git arguments constitute <magic-incantation>
?