Customizing Git with Alias Commands
Posted on June 7, 2024 • 2 min read • 248 wordsStreamline your Git workflow by creating custom alias commands for frequently used operations.
Customizing Git with aliases can streamline your workflow by shortening common commands. Here’s how to create and use Git aliases:
git config --global alias.co checkout
Sets git co
as an alias for git checkout
.
git config --global alias.lg "log --oneline --graph --decorate"
Sets git lg
as a shortcut for a detailed log view.
git config --global alias.st status
Sets git st
as an alias for git status
.
git config --global alias.addall
"add ."
Sets git addall
as an alias for git add .
.
git config --global alias.ci "commit -m"
Sets git ci
as an alias for git commit -m
.
git config --global alias.co checkout
Sets git co
as an alias for git checkout
.
git config --global alias.fa "fetch --all"
Sets git fa
as an alias for git fetch --all
.
git config --global alias.ri "rebase -i"
Sets git ri
as an alias for git rebase -i
.
git config --global alias.squash "rebase -i --autosquash"
Sets git squash
as an alias for git rebase -i --autosquash
.
git config --global alias.reset "reset --hard"
Sets git reset
as an alias for git reset --hard
.
Creating aliases for frequently used Git commands can save time and improve efficiency. Customize your Git workflow with these aliases.