Skip to content

Instantly share code, notes, and snippets.

@aminin
Created June 29, 2012 10:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aminin/3017311 to your computer and use it in GitHub Desktop.
Save aminin/3017311 to your computer and use it in GitHub Desktop.
Убийца слитых веток
#!/bin/bash
# Чистит локальные слитые ветки
for i in `git branch | grep "^[^*]\+"`; do git branch -d $i; done;
# Чистит слитые ветки в удалённом репозитории
git log --pretty=format:%H HEAD~1 > /tmp/git-history.txt
for i in `git br -r | grep -o "[^ \/]\+$" | sort | uniq`;
do
H=`git log -1 --pretty=format:%H origin/$i`;
e=`grep "$H" /tmp/git-history.txt`;
if [ -n "$e" ];
then
echo "git push origin :$i";
fi;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment