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