A Real Alias Is Just a Named Command
git config alias.lg "log --oneline --graph --decorate -8"
git lg
Whatever follows alias.<name> is a real, ordinary git command (or command chain) — git <name> runs it exactly as typed.
Compound Aliases: Real Shell Commands
git config alias.done '!f() { git push && git switch master; }; f'
A leading ! runs a genuine shell command instead of a plain git subcommand — enough to chain multiple real git commands into one "I'm done" sequence.
Five Real, Personal Shortcuts, Confirmed
git lg
git today
git unwip
git save "message"
Every one of these is checked directly in this lab — not just defined and trusted.
A real git alias is nothing more than git config alias.<name> "<real command>", after which git <name> runs it. This lab builds five real, genuinely useful ones: a pretty log graph, a "what did I commit today" query, an "undo my last commit but keep the changes" one-liner, a shorter stash-with-message command, and a compound "I'm done, ship it" sequence combining two real commands into one.
Every single one gets genuinely run at least once in this lab — a configured alias that has never actually been tested is just an unverified guess.
git config alias.<name> "<command>"
Defines a real, personal shortcut — git <name> then runs exactly the given command. Confirmed directly in this lab: five aliases, each genuinely invoked and shown to do exactly what it claims.
Compound alias with a leading !
A real alias starting with ! runs an actual shell command rather than a plain git subcommand, allowing multiple real git commands to be chained into one. Confirmed directly in this lab: git done genuinely attempted a real push, and its && chain correctly stopped there once the branch-protection hook rejected it — the switch never ran, exactly as a real shell && should behave.
Takeaways
- git config alias.<name> "<command>" defines a real, personal shortcut for any git command or chain
- A leading ! in an alias definition runs a real shell command, enabling multiple git commands chained into one
- reset --soft HEAD~1 is the real mechanism behind "undo my last commit but keep the changes" — confirmed directly by checking git status afterward
- An alias is only genuinely trustworthy once it has actually been run — never take a definition on faith