Warum Aliase wichtig sind
Git-Aliase verwandeln lange, ausfuhrliche Befehle in kurze, einpragsame Abkurzungen. Sobald Sie eine Handvoll Aliase in Ihrer ~/.gitconfig konfiguriert haben, hort der Kampf mit der CLI auf.
Aliase konfigurieren
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
Zehn Aliase, die sich lohnen
[alias]
st = status -sb
co = checkout
br = branch
ci = commit
last = log -1 HEAD --stat
unstage = reset HEAD --
lg = log --oneline --graph --decorate --all
amend = commit --amend --no-edit
wip = !git add -A && git commit -m 'WIP'
undo = reset --soft HEAD~1
Shell-Aliase versus Git-Aliase
# In ~/.zshrc oder ~/.bashrc
alias g='git'
alias gst='git status -sb'
alias gp='git pull --rebase'
Aliase, die Shell-Befehle ausfuhren
[alias]
cleanup = "!git branch --merged main | grep -v '\\*\\|main\\|master' | xargs -n 1 git branch -d"
root = "!pwd"
publish = "!git push -u origin $(git symbolic-ref --short HEAD)"
Aliase entdecken und auditieren
git config --get-regexp '^alias\\.'