Finding all branches with no merged changes

suggest change

This lists remote-tracking branches other than origin/master whose diff against master (from the merge base) is empty, which usually means they have no commits that master lacks. git branch -r also prints origin/HEAD -> origin/master, and that line will not run cleanly through this loop.

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:

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



Table Of Contents