Last active
April 4, 2017 09:23
-
-
Save akesson/b52778f665dd4019fe41e8a7712d972e to your computer and use it in GitHub Desktop.
Useful git aliases
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
[alias] | |
# delete all local tags and then fetch the ones on the server | |
cleantags = !git tag -l | xargs git tag -d && git fetch -t | |
# adds and pushes a single tag | |
addtag = "!f() { git tag $1; git push origin $1; }; f" | |
# removes all tags matching input on remote only. git removetags string_in_tag | |
removetags = "!f() { git tag -l | grep $1 | xargs git push --delete origin; echo 'Deleted tags remotely only. If all ok, do a cleantags to remove them locally as well or if NOK use pushtags to re-push them to remote'; }; f" | |
# push all local tags to server | |
pushtags = push origin --tags | |
# find the sha and branch(es) of a tag | |
findtag = "!f() { SHA=`git log -1 $1 --format="%h"` || exit 1; echo "SHA: $SHA"; echo "Branches:"; git branch --contains $SHA; }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment