Gitalias
Summary
Gitalias maps each git command to the shortest possible alias. You don't need to memorize aliases — you can derive them from the full command.
tip
The alias command lists all aliases (alias for config --global --get-regexp ^alias\\.)
Usage
- Copy the alias list and paste it into your .gitconfig file.
Usage Example
Implement feature on a new branch
git th # reset --hard
git sm # switch main
git l # pull
git sc feature/foo # switch --create feature/foo
# Implement feature ...
git aa # add --all
git cm "Implement foo" # commit --message "Implement foo"
Create and Merge PR
Use GitHub CLI or web UI ...
Clean feature branch
git sm # switch main
git l # pull
git opo # remote prune origin
git bdf feature/foo # branch --delete --force feature/foo
Rules
Each alias is created according to several simple rules:
Each command is represented by a single letter.
- For example
mergeis represented bym.
- For example
Each parameter/value is formed from the first letter of each word.
- For example
--no-commitis represented bync. - Branch
mainis represented by letterm - If the short parameter is uppercase letter then the letter is doubled.
- For example
branch -Dis represented bybdd.
- For example
- For example
Parameters are sorted in alphabetical order.
- For example:
merge --no-commit --squashis represented bymncs. - When the alias contains parameter that requires value to be specified by the user, that parameter is the last one.
- For example
log --oneline --max-count <MAX_COUNT>is represented bylomc.
- For example
- Parameter
--dry-runis always the last one.- For example
git clean --force --dry-runis represented bygit nfdr
- For example
- For example: