Finding all branches with no merged changes

suggest change

Sometimes you might have branches lying around that have already had their changes merged into master. This finds all branches that are not master that have no unique commits as compared to master. This is very useful for finding branches that were not deleted after the PR was merged into master.

for branch in $(git branch -r) ; do
  [ "${branch}" != "origin/master" ] && [ $(git diff master...${branch} | wc -l) -eq 0 ] && echo -e `git show --pretty=format:"%ci %cr" $branch | head -n 1`\\t$branch
done | sort -r

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents