10 Essential Git Commands Every Developer Should Know
Table of ContentsTap to expand
Series: React Mastery
Part 2 of 3View all parts
Essential Git Commands Every Developer Should Know
Git is one of those tools that you think you understand until you encounter a merge conflict at 2 AM. Here's the commands I actually use daily, explained in plain English.
The Basics
These are the commands you'll use 90% of the time:
# Check what's changed
git status
# Stage everything
git add .
# Commit with a descriptive message
git commit -m "feat: add hero section with gradient animation"
# Push to remote
git push origin mainBranching Like a Pro
Never work directly on main. Create feature branches:
# Create and switch to a new branch
git checkout -b feature/blog-page
# Switch between branches
git checkout main
# Merge a feature branch
git merge feature/blog-pageUndoing Mistakes
We all make mistakes. Git has your back:
# Undo the last commit but keep changes
git reset --soft HEAD~1
# Discard all changes in a file
git checkout -- filename.js
# Amend the last commit message
git commit --amend -m "fix: corrected typo in component name"My Commit Message Convention
I follow a simple convention that makes the git log actually useful:
| Prefix | Use Case |
|--------|----------|
| feat: | New feature |
| fix: | Bug fix |
| docs: | Documentation |
| style: | Formatting changes |
| refactor: | Code restructuring |
| chore: | Maintenance tasks |
Pro Tips
- Commit often, push frequently — Small commits are easier to review and revert
- Write meaningful messages — "fix stuff" tells you nothing
- Use
.gitignore— Never commitnode_modulesor.envfiles - Learn
git stash— It saves your work-in-progress without committing
# Stash your current changes
git stash
# Apply the stashed changes back
git stash popConclusion
Git is a superpower once you get comfortable with it. Start with the basics, build muscle memory, and gradually explore more advanced features. Your future self will thank you for those clean commit histories!
Series: React Mastery
Part 2 of 3View all parts
Related Posts

How to Write Your First React App (Complete Beginner Guide to React & JavaScript)
If you know basic HTML and want to move into modern web development, React is one of the best places to start. Build your first React app step by step.

Why Small Businesses in Nepal Are Easy Targets for Cyber Attacks (And How to Fix It)
As Nepal's digital economy surges with eSewa, Fonepay, and social media commerce, small businesses are increasingly falling victim to cyber attacks. Here's why it happens and how you can stop it.

Building a Scalable Microservices Architecture: A Visual Guide
Demystifying microservices concepts, essential design patterns, and how to build scalable distributed backend systems.