Skip to content

Instantly share code, notes, and snippets.

@Nikkely
Last active July 9, 2019 07:35
Show Gist options
  • Save Nikkely/1e0f67b014ee9d2e512538a9ad51ffca to your computer and use it in GitHub Desktop.
Save Nikkely/1e0f67b014ee9d2e512538a9ad51ffca to your computer and use it in GitHub Desktop.
"Marged"
for branch in `git branch -r --merged | grep -vE "/master$|/develop$"`
do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an" $branch | head -n 1` \\t$branch;
done | sort -r
"No-Marged"
for branch in `git branch -r --no-merged | grep -vE "/master$|develop$"`
do echo -e `git log --no-merges -n 1 --format="%ci, %cr, %an, %ae, " $branch | head -n 1` \\t$branch;
done | sort -r
" delete remote
git branch -r --merged | grep -vE "/master$|/develop$" | sed -e 's/.*origin\///' | xargs -I % git push --delete origin %
" delete local
git branch --merged | grep -vE "/master$|/develop$" | xargs -I % git branch -d %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment