Which command lists all the local branches that diverged from the remote branches they follow (either because the local branch has new commits or the remote one)?


You can use git fetch to get the files from your remote (without merging), then use

git log --oneline --decorate --graph --all

and you should be able to see the most recent commits of all the various branches.

  • Thanks, but this shows the whole (long) history and leaves it to me to figure out which branch has new commits. I'd really like to only get the branches name. – John Jun 18 '15 at 17:08
  • Ignore my (now deleted) last comment. Just use 'git remote -v update' This will show you which tracked branches are not up to date. – barriboy Jun 18 '15 at 18:21
  • That command tells me that master is "[up to date]", even though it is five commits behind origin/master. :-( – John Jun 18 '15 at 19:03

Maybe try something simple in shell, such as:

for b in $(git branch -l | sed -re 's/^[ *]+//g'); do echo $b:; git diff origin/$b..$b --stat ; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.