Last active
July 6, 2018 13:30
-
-
Save nunosilva800/840a400f7bc94c2e984b to your computer and use it in GitHub Desktop.
cleaning git repo
This file contains 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
# To delete all branches that are already merged into the currently checked out branch: | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d |
use flag -r
to force acting on remote-tracking branches
others:
git branch -r
to list old tracking branches that have been left in your local repo.git remote prune origin
to delete the local tracking branches that don’t exist on origin anymoregit ls-remote --heads origin
list branches on remote origingit push origin --delete old_branch
delete old branch on origin
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or as a git alias: