Last active
January 31, 2017 01:33
-
-
Save AndreiRailean/10e40357cea7c92ca1ae60eacb630806 to your computer and use it in GitHub Desktop.
Useful Git Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Checkout and track remote branch | |
git checkout --track -b local_branch remote/remote_branch | |
# Delete all merged local branches except for master | |
git branch --merged master | grep -v master | xargs git branch -d | |
# Delete all branches from origin remote except master | |
git branch -a --merged remotes/origin/master | grep -v master | grep "remotes/origin/" | sed 's|remotes/origin/||' | xargs -n 1 git push --delete origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment