Git Aliases can be set as following:
git config --global alias.unstage 'reset HEAD --'This makes the following two commands equivalent:
$ git unstage fileA
$ git reset HEAD -- fileATo use a non-git command, prefix it with a !:
git config --global alias.visual '!gitk'To list all aliases, we can use
git config --get-regexp ^aliasSome aliases that I use
| alias | command |
|---|---|
unstage <file> | reset HEAD -- <file> |
amend | git stage -A && git commit --amend --no-edit |
force-push | git push --force-with-lease |