Whether you’re debugging a feature, collaborating with a team, or pushing your side project to GitHub – Git commands are your power tools! 💪
Here’s a real-world cheat sheet to boost your workflow: 👇
🔍 git diff – Check what’s changed before committing.
(Like previewing edits in a doc before saving.)
📝 git commit -a -m "msg" – Save your work with a clear message.
(Like hitting 'Save' in Word.)
♻️ git commit --amend – Fix that typo in your last commit message! 🛠️
📦 git add <file> – Stage files before committing.
(Putting files in the "commit basket.")
⚙️ git status – See where you stand.
(Think of it like a project dashboard.)
🌱 git checkout -b new-feature – Start a fresh branch.
(Like opening a new page for your next idea.)
📑 git checkout branch_name – Switch between tasks/branches.
(Just like swapping tabs.)
💼 git stash / git stash pop – Pause and resume your changes.
(Temporary save, like a draft.)
🚛 git pull / git fetch – Bring in updates.
(Like syncing with teammates' work.)
🚢 git push origin branch – Ship your code!
(Time to share your work with the world.)
🧬 git merge / git rebase – Combine work smartly.
(Choose merge for teamwork, rebase for clean history.)
⛔ git reset / git revert – Undo mistakes safely.
(Control-Z for your repo.)
🎯 git cherry-pick commit_id – Grab that one great commit from another branch.
(Like borrowing one perfect slide for your deck.)
🗑️ git branch -D branch_name – Clean up old branches.
(Tidy repo, tidy mind.)
🔗 git branch --set-upstream-to=remote_branch – Connect your branch to remote.
(Think: setting up sync.)
---
Follow Govind Kr. Singh for more insightful content.
🔥 Save this post
🧠 Use it daily
🧙♂️ Code like a Git wizard