Skip to content

Instantly share code, notes, and snippets.

@Bojole
Last active October 27, 2022 18:51
Show Gist options
  • Save Bojole/9ad0a9a858327763a453e5dcd2141d5d to your computer and use it in GitHub Desktop.
Save Bojole/9ad0a9a858327763a453e5dcd2141d5d to your computer and use it in GitHub Desktop.
Git Aliases
git config --global alias.a "! git add . && git status"
git config --global alias.aa "! git add . && git add -u . && git status"
git config --global alias.ac "! git add . && git commit"
git config --global alias.acm "! git add . && git commit -m"
git config --global alias.alias "! git config --list | grep 'alias\.' | sed 's/alias\.\([^=]*\)=\(.*\)/\1\ => \2/' | sort"
git config --global alias.au "! git add -u . && git status"
git config --global alias.c "commit"
git config --global alias.ca "commit --amend"
git config --global alias.cm "commit -m"
git config --global alias.co checkout
git config --global alias.d diff
git config --global alias.l "log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'"
git config --global alias.last "log -1 HEAD"
git config --global alias.lg "log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
git config --global alias.ll "log --stat --abbrev-commit"
git config --global alias.llg "log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit"
git config --global alias.master checkout master
git config --global alias.s status
git config --global alias.unstage "reset HEAD --"
@Bojole
Copy link
Author

Bojole commented May 11, 2018

To load all these aliases for your current environment and also have them configured --global-ly. Perform these steps:

  • download this git-alias.sh file
  • in terminal run source ~/git-alias.sh <-- Assuming the file was in your home folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment