Last active
March 7, 2018 16:08
-
-
Save stefan-girlich/2214eb9340f38cdc776e826895c204b5 to your computer and use it in GitHub Desktop.
Cleans up your Git working directory, e. g. after completing a merge request
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
#!/bin/sh | |
# Save file in executable PATH, e. g. /usr/bin | |
# Usage: "git fullclean" | |
git checkout develop | |
git pull --rebase | |
git fetch --prune | |
BRANCHES_TO_KEEP_REGEX="(^\*|master|develop)" | |
git branch --merged|egrep -v $BRANCHES_TO_KEEP_REGEX|xargs git branch -d | |
# also erases untracked files | |
# git clean -f -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment