GIT

Git Commands You Must Know 🚀

Published on Dec 9, 2025 by MSMAXPRO • 6 min read

Git Commands

Every developer knows `git add`, `git commit`, and `git push`. But to truly master version control and save yourself from "merge hell," you need a few more tools in your arsenal.

Here are the essential Git commands that will level up your workflow.

1. git status

Before doing anything, always check the state of your working directory.

git status

This tells you which files are staged, unstaged, or untracked.

2. git log --oneline

Viewing a long history of commits can be messy. Use this to get a clean, single-line list of commits.

git log --oneline

3. git branch & git checkout

Never work directly on the `main` branch. Create a new branch for every feature.

# Create a new branch
git branch feature-login

# Switch to that branch
git checkout feature-login

# Shortcut (Create & Switch)
git checkout -b feature-login

4. git stash

Imagine you are working on a feature, but your boss asks you to fix a critical bug *right now*. You aren't ready to commit your half-finished work. What do you do?

git stash

This temporarily saves your changes. You can now switch branches, fix the bug, come back, and run:

git stash pop

5. git diff

Want to see exactly what lines of code you changed before staging them?

git diff

6. git reset (The Undo Button)

Made a mistake in your last commit? You can undo it.

# Undo commit, keep changes in file
git reset --soft HEAD~1

# Undo commit, DESTROY changes (Dangerous!)
git reset --hard HEAD~1

Conclusion

Mastering these commands will make you a more confident and efficient developer. Stop fearing the terminal and start controlling your code!

← Back to All Blogs