Finding all branches with no merged changes
suggest changeThis 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents