Git Tips Slides
PageUp x2: previous · PageDown x2: next · Home: index

List branches

git-list-branches.sh

This script shows local branches and origin/<branch> branches in one combined list.

It sorts them by recent activity and shows, for each branch:

  • when the last commit happened
  • the commit subject
  • whether the local branch is synced with origin, ahead, behind, diverged, local-only, or remote-only

By default it runs git fetch --prune origin first, so the view is based on fresh remote-tracking refs.