We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http://rob.by/2013/remove-merged-branches-from-git
function rmb { current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') if [ "$current_branch" != "master" ]; then echo "WARNING: You are on branch $current_branch, NOT master." fi echo "Fetching merged branches..." git remote prune origin remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$") local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$") if [ -z "$remote_branches" ] && [ -z "$local_branches" ]; then echo "No existing branches have been merged into $current_branch." else echo "This will remove the following branches:" if [ -n "$remote_branches" ]; then echo "$remote_branches" fi if [ -n "$local_branches" ]; then echo "$local_branches" fi read -p "Continue? (y/n): " -n 1 choice echo if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then # Remove remote branches git push origin `git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$" | sed 's/origin\//:/g' | tr -d '\n'` # Remove local branches git branch -d `git branch --merged | grep -v 'master$' | grep -v "$current_branch$" | sed 's/origin\///g' | tr -d '\n'` else echo "No branches removed." fi fi }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
http://rob.by/2013/remove-merged-branches-from-git
The text was updated successfully, but these errors were encountered: