How many times a day do you type commands like git status, git checkout, or git commit in your terminal? For active developers, the answer is easily in the dozens or hundreds. Typing out these full commands repeatedly wastes keystrokes, increases typing errors, and slows down your development momentum.
Git has a built-in 기능 to address this: Aliases. By configuring aliases, you can map complex options or frequent commands to short, custom abbreviations.
In this 가이드, we will walk through 설정 up aliases and share a list of the most popular configurations to boost your daily productivity.
1. How to Define Git Aliases
You can add Git aliases by running config commands directly in your terminal, or by opening and editing your global configuration file (~/.gitconfig) with a text editor.
Configuring via CLI:
# Register 'st' as a shortcut for 'status'
git config --global alias.st status
Configuring via ~/.gitconfig:
Open the config file and structure it under the [alias] section:
[alias]
st = status
co = checkout
br = branch
ci = commit
2. Essential Aliases for Every Developer
Here are the basic shortcuts to minimize keystrokes for your most frequent workflows:
[alias]
st = status -sb # Displays a short, concise status summary
co = checkout
br = branch
ci = commit
cm = commit -m # Fast commit with a message inline
di = diff
pl = pull
ps = push
The status -sb flag is highly recommended because it strips away verbose instructions, leaving only the branch name and a list of modified files.
3. Advanced and High-Productivity Aliases
Let’s look at more complex aliases that combine formatting options and shell scripts.
① Beautiful Log Visualization (git graph)
Reading commit paths and merge histories in the standard terminal output is difficult. Register a 커스터마이즈 log viewer alias:
git config --global alias.graph "log --graph --date=short --decorate --pretty=format:'%C(yellow)%h%Creset %C(magenta)%ad%Creset%C(auto)%d%Creset %s %C(cyan)[%an]%Creset'"
Running git graph will 디스플레이 a colorful, clean ASCII branch tree graph mapping commit dates, authors, and references.
② Modify the Last Commit on the Fly (git amend)
If you forgot to stage a file or made a typo in your last commit message, use this alias to absorb staged changes into the last commit without editing the message:
[alias]
amend = commit --amend --no-edit
③ Clean Up Merged Branches (git sweep)
As 기능 get integrated, your local environment fills up with old, merged branches. Use a shell pipeline (invoked with a ! prefix in the alias definition) to clean them up:
[alias]
sweep = "!git branch --merged | grep -v '\\*' | grep -v 'main' | grep -v 'master' | grep -v 'develop' | xargs -r git branch -d"
Conclusion
설정 up Git aliases is a low-effort, high-yield configuration change. Once written to your global ~/.gitconfig file:
- Typing requirements are minimized for primary commands.
- Complex log formatting commands are reduced to single words.
- Workspace cleanup commands can be automated using shell triggers.
커스터마이즈 your config files today to build a faster and more efficient command-line workflow.

