Von Gast (nicht überprüft) , 29 April 2026

Eingebautes Shorthand

Neben Aliassen hat Git eine Reihe eingebauter Shorthand-Notationen.

HEAD-Relativen

HEAD
HEAD~
HEAD~1
HEAD~5
HEAD^
HEAD^^
HEAD^2
HEAD^{tree}

Reflog-Referenzen

HEAD@{1}
HEAD@{yesterday}
HEAD@{2.hours.ago}
main@{push}

Branch-Shorthand

git checkout -
git switch -
git merge @{u}
git rebase @{u}
git push HEAD

SHA-Shorthand

git show abc
git checkout abc1234
git config --global core.abbrev 12

Range-Shorthand

main..feature
main...feature
feature^@
feature^!

Pathspec-Shorthand

git add :/
git checkout -- :/some-path
git diff -- '*.js'
git diff -- ':!vendor/'

Der ---Trenner

git checkout main
git checkout -- main
git diff master file
git diff master -- file

Nutzliche Ein-Zeichen-Flags

git commit -a
git commit -am "msg"
git pull -r
git push -u
git log -p
git log -S 'string'
git log -G 'regex'

Nutzliche Umgebungsvariablen

GIT_EDITOR=vim git commit
GIT_AUTHOR_DATE='2024-01-01T12:00:00' git commit -m "backdated"
GIT_PAGER=cat git log
GIT_TRACE=1 git fetch

Konfigurations-Shorthand

git config --global -e
git config -l
git config --get-regexp '^alias\\.'