Git Aliases for Daily Productivity
Five real, personal aliases. Each one genuinely tested, not just configured.
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.\n\nEvery 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.
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.
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.
📊 A Real Pretty Log Graph
One alias, genuinely used.
cd ~/team-recipes && git config alias.lg "log --oneline --graph --decorate -8"cd ~/team-recipes && git lgstudent@lab:~$ cd ~/team-recipes && git config alias.lg "log --oneline --graph --decorate -8" student@lab:~$ cd ~/team-recipes && git lg * ab4261d (HEAD -> master) RECIPE-306: Renormalize line endings * 43b456a RECIPE-305: Normalize line endings to LF * ff12df1 RECIPE-309: Add party playlist notes * 7e0981a RECIPE-304: Add updated freezer labels guide * 6f095be RECIPE-301: Add meal prep containers guide * b7bae1b Track large binary assets with Git LFS * 5e8a609 Add product photo asset * 1cd860e Update cooking-utils submodule to latest
📅 "What Did I Do Today"
A real daily digest, genuinely queried — genuinely empty so far.
cd ~/team-recipes && git config alias.today "log --since=midnight --oneline"cd ~/team-recipes && git todaystudent@lab:~$ cd ~/team-recipes && git config alias.today "log --since=midnight --oneline" student@lab:~$ cd ~/team-recipes && git today
↩️ Undo the Last Commit, Keep the Changes
A real one-liner, and real proof it actually keeps the changes.
cd ~/team-recipes && git config alias.unwip "reset --soft HEAD~1"cd ~/team-recipes && echo 'Lg Test' > lg-test.md && git add lg-test.md && git commit -m "RECIPE-307: Add lg test recipe"cd ~/team-recipes && git unwipcd ~/team-recipes && git statusstudent@lab:~$ cd ~/team-recipes && git config alias.unwip "reset --soft HEAD~1" student@lab:~$ cd ~/team-recipes && echo 'Lg Test' > lg-test.md && git add lg-test.md && git commit -m "RECIPE-307: Add lg test recipe" [master 22ae1ca] RECIPE-307: Add lg test recipe 1 file changed, 1 insertion(+) create mode 100644 lg-test.md student@lab:~$ cd ~/team-recipes && git unwip student@lab:~$ cd ~/team-recipes && git status On branch master Your branch is ahead of 'origin/master' by 129 commits. (use "git push" to publish your local commits) Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: lg-test.md
💾 Save and Ship: The Last Two Aliases
A real stash shortcut, and a real compound "I'm done" sequence — that meets a real, existing team policy.
cd ~/team-recipes && git commit -m "RECIPE-307: Add lg test recipe"cd ~/team-recipes && git config alias.save "stash push -m"cd ~/team-recipes && echo 'test' >> lg-test.md && git save "wip: lg test tweak"cd ~/team-recipes && git stash popcd ~/team-recipes && git checkout -- lg-test.mdcd ~/team-recipes && git config alias.done '!f() { git push && git switch master; }; f'cd ~/team-recipes && git donestudent@lab:~$ cd ~/team-recipes && git commit -m "RECIPE-307: Add lg test recipe" [master 3bce3a3] RECIPE-307: Add lg test recipe 1 file changed, 1 insertion(+) create mode 100644 lg-test.md student@lab:~$ cd ~/team-recipes && git config alias.save "stash push -m" student@lab:~$ cd ~/team-recipes && echo 'test' >> lg-test.md && git save "wip: lg test tweak" Saved working directory and index state On master: wip: lg test tweak student@lab:~$ cd ~/team-recipes && git stash pop On branch master Your branch is ahead of 'origin/master' by 130 commits. (use "git push" to publish your local commits) Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: lg-test.md no changes added to commit (use "git add" and/or "git commit -a") Dropped refs/stash@{0} (1e83a6c8447970a95bc0eae7ebb81aea22da773e) student@lab:~$ cd ~/team-recipes && git checkout -- lg-test.md student@lab:~$ cd ~/team-recipes && git config alias.done '!f() { git push && git switch master; }; f' student@lab:~$ cd ~/team-recipes && git done Enumerating objects: 48, done. Counting objects: 100% (48/48), done. Compressing objects: 100% (24/24), done. Writing objects: 100% (44/44), 4.41 KiB | 237.00 KiB/s, done. Total 44 (delta 17), reused 39 (delta 14), pack-reused 0 remote: error: direct commit 3bce3a39181f4edb16777305bdd9681686576957 rejected on protected branch master remote: master only accepts merge commits from a reviewed pull request To ../recipes-origin.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to '../recipes-origin.git'
Lab 3.6.4 complete. Five real, personal aliases, each genuinely configured and tested:\n\n\n git lg : ✅ pretty log graph\n git today : ✅ daily digest\n git unwip : ✅ undo, keep changes\n git save : ✅ stash shortcut\n git done : ✅ ran for real — push correctly rejected by the Block 2.5 branch-protection hook\n
Enable JavaScript to run the live terminal and track your progress.