Run these commands in your terminal:
1. git unpushed
This shows you exactly what is on your local machine that has not been pushed to the server yet.
git config --global alias.unpushed "log @{u}..HEAD --oneline --graph --decorate"
- Logic: It compares your current branch to its Upstream (the server).
If it returns nothing, you are safe to switch branches or delete things.
2. git check
Use this before you checkout main.
It combines your status and your unpushed work.
git config --global alias.check "status -sb && git log @{u}..HEAD --oneline"
- Logic: It gives you a short branch status (shows if you’re ahead/behind the server) and lists any local commits you forgot to push.
3. git snapshot
“Smart Stash”: Avoid the manual -- filename trap by using the interactive patch mode.
git config --global alias.snapshot "stash push -m 'Interim Snapshot' -u"
- Logic: Adding
-uensures untracked files (newly created files) are included.
Most people lose work because they forget Git doesn’t “see” new files unless you-u.
How to use them now:
git unpushed:
Run this before you close your laptop.
If you see a list, push it.git check:
Run this beforegit checkout main.
If you see “ahead by 1 commit,” you haven’t pushed your work yet.git snapshot:
Use this instead of a rawgit stash.
It’s safer and includes your new files.
One final “Super-Log” command
If you ever feel lost again, run this “God View” command. It shows every branch (local and remote) and how they connect:
git log --graph --oneline --all --decorate
Pro-Tip:
You can also add aliases to your .bashrc or .zshrc:
<code>glog="git log --graph --oneline --all --decorate"
