Raise your hand if you’ve ever stared at your terminal, completely blanking on basic Git commands. 😅
Whether you’re switching devices, reinstalling your OS, or just need a refresher, forgetting Git workflows is painfully relatable. After many frantic Google searches, I’ve compiled a survival guide for setting up Git and jogging your memory—complete with cross-platform tips and cheat sheets.
- "Wait, How Do I Install Git Again?"
Linux (Debian/Ubuntu):
sudo apt update && sudo apt install git -y
Linux (Fedora):
sudo dnf install git
Mac:
- Via Homebrew (recommended):
brew install git
- Or use Xcode CLI Tools:
xcode-select --install
Windows:
- Download the official installer: git-scm.com
- Run the
.exe
and follow prompts (check "Git Bash" for terminal access).
- "I Forgot How to Configure Git!" Set your identity (do this once per machine):
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
💡 Pro Tip: Use --global
for system-wide settings or --local
per-project.
- "What’s the Command for…?" – Cheat Sheet
Scenario Command Start a new repo git init
Clone a repo git clone https://github.com/user/repo.git
Check status git status
Stage all changes git add .
(orgit add filename
)Commit changes git commit -m "Your message here"
Push to remote git push origin main
(or branch name)Pull latest changes git pull
Create a new branch git checkout -b new-branch-name
Switch branches git checkout branch-name
Merge branches git merge branch-name
View commit history git log --oneline --graph
Undo local changes git restore filename
(orgit checkout -- filename
)Stash changes temporarily git stash
(pop withgit stash apply
)
- "Help! I Still Forget Things!" – Lifeline Resources 📌 Bookmark these for quick access!
- 📖 Official Git Docs: git-scm.com/docs – The ultimate reference.
- 🖥️ Interactive Learning: Learn Git Branching – Master branches visually.
- 📄 Cheat Sheet PDFs: Atlassian’s Git Cheat Sheet.
- 👥 Community Wisdom: Stack Overflow’s Git FAQs.
- Pro Tips to Avoid Future Panic
- Alias Commands: Shorten frequent commands in
~/.gitconfig
:
- Alias Commands: Shorten frequent commands in
[alias]
st = status
cm = commit -m
co = checkout
- Use a GUI: Tools like GitKraken or VS Code’s built-in Git UI.
- Practice Daily: Repetition is key! Try small projects to reinforce muscle memory.
Final Note:
Forgetting Git is normal—don’t let impostor syndrome win. Bookmark this post, keep those cheat sheets handy, and embrace the command-line chaos. 💻✨
What’s your go-to Git lifesaver? Share below! 👇
(Featured image idea: A chaotic desk with a laptop, coffee, and a sticky note saying "git push --force? 😬")
Top comments (0)