Git is powerful. It’s also a black hole where hours disappear if you’re still typing the same long commands you learned in 2014 or digging through a history full of “fix typo” commits from three months ago. I’ve whittled my daily routine down to something I can do without cursing into my soda. It’s fast, clean, and takes under seven minutes per task.
- Make a new branch every time
git checkout -b feature/short-descriptive-name
No “one branch to rule them all.” Bug fixes, new features, experiments—each gets its own.
- Stage only what you mean to commit
git add -p
Keeps you from cramming unrelated changes into one commit, which is basically code hoarding.
- Keep commit messages short and clear Format:
[type] present-tense description
Example:
fix: correct typo in config loader
- Rebase for cleanup, don’t merge
git pull --rebase origin main
Keeps history straight so you don’t need a red string conspiracy board to follow it later.
- Squash before you send it off
git rebase -i HEAD~n
Replace n with however many commits you’re mashing together.
- Push it up
git push -u origin feature/short-descriptive-name
This saves me from the “what fresh hell is this” moment when reviewing old code. History stays readable. Brain stays uncluttered. And if you’ve been treating your repo like a junk drawer, try this for a week. You won’t go back.
Top comments (0)