Skip to content

Instantly share code, notes, and snippets.

@idleberg
Last active February 14, 2024 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idleberg/de2a0ce6a595ee180b51255f96d88570 to your computer and use it in GitHub Desktop.
Save idleberg/de2a0ce6a595ee180b51255f96d88570 to your computer and use it in GitHub Desktop.
my-git-aliases.md

The Git documentation lists some fairly common aliases:

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status

Here are some of my personal ones:

# overwrite previous commit message
git config --global alias.amend commit --amend -m

# unstage files
git config --global alias.unstage restore --staged

# delete a tag, both, locally and remote
git config --global alias.untag '!git tag -d $1 && git push origin :refs/tags/$1'

# if git is locked, e.g. due to an aborted pre-commit hook
git config --global alias.unlock '!rm --verbose ./.git/index.lock'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment