Get list of final branches (which are final tips)

branch, git, git-branch, hierarchy, tree

Solution

Updated to handle any amount of branches, any kind of tips:

git for-each-ref --format='%(objectname)^{commit}' \
| git cat-file --batch-check='%(objectname)^!' \
| grep -v missing \
| git log --oneline --stdin

and this is pretty tweakable, you can can limit the kind of tips you're looking for only listing those refs with for-each-ref, you can adding further exclusions for tag tips, whatever.

Problem

How can i get a list of branches which are only final branches (which are not parents of any other commits) - other words branches which are tips of commit tree (final nodes). I expected some option like --final or --tips in `git branch` command but there only --merged, --no-merged and --contains options.

Original source