Last active
November 23, 2021 11:04
-
-
Save odellt/94c39122abf0a9c319a2b687aedee2d1 to your computer and use it in GitHub Desktop.
Helper commands for git
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
# Command to call git status -s on all repositories in a directory | |
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status | sed "s/[(][^)]*[)]//" | sed '/^[[:space:]]*$/d' && echo)' \; | |
# Command to delete local branches that have been merged, except special branches | |
git branch --merged | egrep -v "(^\*|master|production|other-special-branch)" | xargs git branch -d | |
# Command to pull a pull request locally | |
git pull origin pull/[PR_ID]/head | |
# Commands to delete all tags local and remote | |
# Delete All local tags | |
git tag -d $(git tag -l) | |
# Fetch remote All tags | |
git fetch | |
# Delete All remote tags | |
git push origin --delete $(git tag -l) | |
# Delete All local tags | |
git tag -d $(git tag -l) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment