Devy
Sun, 25 Jan 2026 20:25:29 +0000
Desarrollo

The 15 Git Commands Every Software Engineer Uses (And Why They Matter More Than You Think)

originally published on dev.to by Hadil Ben Abdallah
Credits below

For a long time, I thought Git was just something I had to survive.

Type a command.
Hope nothing breaks.
If it does… Google fast.

I memorized commands without understanding them.
Copied fixes from Stack Overflow.
Prayed I wouldn’t see merge conflicts.

And somehow… I kept using Git every day without ever feeling confident.

It took me a while to realize this:
Most developers don’t use all of Git.
They use a small set of commands… deeply.

And once I stopped treating Git like magic,
it became a tool I could actually trust.

Git Isn’t Hard… It’s Just Unfamiliar

Git feels intimidating at first because it remembers everything.

Every mistake.
Every experiment.
Every “I’ll clean this later.”

And that can be scary.

But Git isn’t judging you.
It’s protecting your work, even when you don’t realize it yet.

Once I accepted that, learning Git stopped feeling like pressure…
and started feeling like control.

The Git Commands Software Engineers Actually Use Daily

You don’t need 50 commands.
You need the right 15, used calmly and intentionally.

These are the ones that show up in real projects, real teams, real days.

1. git status — Check the Current State of Your Repository

git status shows which files are modified, staged, untracked, or ready to be committed in your repository.

Common mistake:
Running other Git commands without checking git status first, this is how people commit or delete the wrong files.

2. git init — Initialize a New Git Repository

git init creates a new Git repository by adding version control tracking to a project directory.

Common mistake:
Running git init inside an already-initialized repo, creating a nested .git folder and confusing Git completely.

3. git clone — Copy a Remote Repository Locally

git clone downloads a remote repository and creates a full local copy, including its commit history.

Common mistake:
Cloning a repo and immediately pushing changes without understanding the branch structure.

4. git add — Stage Changes for the Next Commit

git add moves file changes into the staging area so they can be included in the next commit.

Important variants:

git add .
Adds all changes in the current directory and subfolders.
If you’re inside a subfolder, parent directory files won’t be included.

git add *
Adds only non-hidden files in the current directory.
Skips files like .env, .gitignore.

git add :
Adds all changes from the repository root, including hidden files.
Safest option when you want everything, regardless of location.

Common mistake:
Using git add . blindly and accidentally staging files you didn’t intend to commit.

5. git commit — Save a Snapshot of Your Changes

git commit records staged changes as a snapshot in the project’s history with a descriptive message.

Common mistake:
Writing vague messages like “update” or “fix stuff”, which makes future debugging painful.

6. git log — View the Commit History

git log displays a list of previous commits, showing changes, authors, and timestamps.

Common mistake:
Ignoring commit history and trying to guess when a bug was introduced.

7. git diff — See What Has Changed

git diff shows line-by-line differences between file versions, commits, or branches.

Common mistake:
Skipping git diff and committing code without reviewing what actually changed.

8. git branch — Manage Parallel Development

git branch lets you create, list, rename, or delete branches for separate lines of development.

Common mistake:
Doing all work on main instead of creating feature branches.

9. git checkout / git switch — Move Between Branches Safely

These commands allow you to move between branches.
Only git checkout can also be used to restore files from another branch or commit.

Important variants:

git checkout branch-name
Old but still widely used.

git switch branch-name
Newer, clearer, and safer for switching branches.

Common mistake:
Switching branches with uncommitted changes and accidentally losing work.

10. git merge — Combine Changes From Different Branches

git merge integrates changes from one branch into another, combining their histories.

Common mistake:
Merging without pulling the latest changes first, leading to unnecessary conflicts.

11. git pull — Update Your Local Repository

git pull fetches changes from a remote repository and integrates them into your current branch (by merge or rebase, depending on configuration)

Common mistake:
Pulling into a dirty working directory instead of committing or stashing first.

12. git push — Share Your Commits With Others

git push uploads your local commits to a remote repository so others can access them.

Common mistake:
Forgetting to pull before pushing, causing rejected pushes and confusion.

13. git stash — Temporarily Save Unfinished Work

git stash stores uncommitted changes so you can return to a clean working directory.

Important variants:

git stash
Saves changes and cleans the working directory.

git stash pop
Restores the most recent stash and removes it.

git stash list
Shows all saved stashes.

Common mistake:
Stashing changes and forgetting they exist.

14. git reset — Undo Changes With Control

git reset moves the current branch pointer and optionally updates the staging area and working directory.

Important variants:

git reset --soft HEAD~1
Keeps changes staged.

git reset --mixed HEAD~1 (default)
Keeps changes unstaged.

git reset --hard HEAD~1
Deletes changes permanently.

Common mistake:
Using --hard without understanding that it permanently removes work.

15. git revert — Undo Changes Safely in Shared History

git revert creates a new commit that reverses the effects of a previous commit without rewriting history.

Common mistake:
Using git reset on shared branches instead of git revert, rewriting history for teammates.

Git Confidence Comes Quietly

Here’s the thing nobody tells you:

Git confidence doesn’t arrive suddenly.

It grows slowly.
After mistakes.
After conflicts.
After fixing something you thought was broken forever.

One day, you stop panicking.
You pause.
You check git status.
And you move forward calmly.

That’s progress.

What I No Longer Do With Git

I don’t copy commands blindly
I don’t fear breaking things
I don’t rush through conflicts
I don’t treat Git like magic

Git isn’t something to fight.
It’s something to understand… one command at a time.

Final Thoughts (From One Developer to Another)

If Git feels confusing right now, that’s okay.
It felt that way for all of us.

You don’t need to master everything.
You just need to get comfortable with the basics and trust that clarity comes with use.

Git commands aren’t about perfection.
They’re about progress, history, and helping software engineers learn without losing their work

Take your time.
Make mistakes.
Commit thoughtfully.

Wishing you clean commits, fewer conflicts, and confidence in your Git journey, friends .

| Thanks for reading!
I hope you found this useful
Please react and follow for more
Made with by Hadil Ben Abdallah | |
|---------|----------|---------|

DEV Community

Hadil Ben Abdallah — DEV Community Profile

Software Engineer • Technical Content Writer (200K+ readers) I turn brands into websites people 💙 to use