Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing Unpushed Branches

Tags:

git

How can I print which of my git branches have unpushed commits? I don't care what the commits contain, but just that they're there and can push pushed off.

I'd like to see something like:

# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.

or nothing at at all, if the local and remote branches are at the same place.

like image 476
ajwood Avatar asked Jul 08 '13 14:07

ajwood


1 Answers

git branch -vv

This will list all your local branches along with their remotes letting you know what their status is (if they are ahead, behind or both).

To be sure that you are up-to-date for all the branches make sure to do git fetch

If you only want to see the branches that are ahead you can do:

git branch -vv | grep ahead
like image 60
Schleis Avatar answered Oct 12 '22 12:10

Schleis