DEV Community

Cover image for The 15 Git Commands Every Software Engineer Uses (And Why They Matter More Than You Think)
Hadil Ben Abdallah
Hadil Ben Abdallah

Posted on

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

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 commands, git basics, version control, software engineering, developer tools

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.

git status command meme showing checking repository state before committing


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.

git init command meme about starting a new git repository


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.

git clone command meme about copying a remote repository locally


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.

git add command meme about staging files before committing


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.

git commit command meme about writing meaningful commit messages


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.

git log command meme about scrolling through commit history


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.

git diff command meme about reviewing code changes before commit


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.

git branch command meme about working on multiple 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.

git checkout and git switch command meme about switching branches


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.

git merge command meme about resolving merge 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.

git pull command meme about updating local code from remote


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.

git push command meme about sending commits to remote repository


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.

git stash command meme about saving unfinished work temporarily


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.

git reset command meme about undoing commits carefully


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 revert command meme about safely undoing changes


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.

git commands, git basics, version control

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
LinkedIn GitHub Daily.dev

Top comments (50)

Collapse
 
anmolbaranwal profile image
Anmol Baranwal

I just remember the most useful ones and search it on the go. anyone wanting to learn git should check this out: udacity.com/course/version-control...

(the best free course out there with 2-3 min videos)

Collapse
 
hadil profile image
Hadil Ben Abdallah

That’s a very real and honest way most of us learn Git.

Remembering the core commands and looking things up when you need them is completely normal; even experienced developers do that. What matters is understanding what a command does to your repo, not memorizing syntax by heart.

And thanks for sharing the Udacity course; it’s a solid resource, especially with short videos that make Git feel less overwhelming.

Appreciate you adding a helpful resource to the thread 😍

Collapse
 
matthewpersico profile image
Matthew O. Persico

git worktree - always create a work tree THEN create a branch. Then instead of using git switch and

Switching branches with uncommitted changes and accidentally losing work

or git stash and

Stashing changes and forgetting they exist

just cd between worktrees to change context.

Collapse
 
hadil profile image
Hadil Ben Abdallah

That’s a great call-out! git worktree is seriously underrated. 😍

You’re absolutely right: using worktrees changes the whole mental model. Instead of juggling uncommitted changes, stashes, and risky branch switches, you just give each context its own working directory and move between them like folders.

I didn’t include git worktree because I was focusing on the most common daily commands, but this is a perfect example of how Git becomes calmer and safer once you go a bit deeper.
Thanks for sharing this, it’s exactly the kind of practical insight that helps teams avoid stress and lost work 💙

Collapse
 
thedevmonster profile image
Dev Monster

This is such a reassuring and practical read 🔥🔥

I really like how you normalize the fear phase of Git, the “type a command and hope nothing breaks” feeling is something almost every developer has been through but rarely talks about. Framing Git as a tool that protects you rather than judges you is a powerful mindset shift.

This is the kind of article that doesn’t just teach commands; it builds confidence. Really well done, especially for codenewbies who need clarity more than complexity

Collapse
 
hadil profile image
Hadil Ben Abdallah

Thank you so much for this 💙 I really appreciate how thoughtfully you read it 😍

That “type a command and hope nothing breaks” phase is exactly what I wanted to normalize, because so many developers go through it quietly and assume they’re just “bad at Git.” In reality, it’s a shared experience; we just don’t talk about it enough.

I’m especially glad the “Git protects you; it doesn’t judge you” framing resonated. Once that mental shift clicks, learning Git stops feeling like walking on eggshells and starts feeling empowering.

Thanks again for the kind words and encouragement; it truly means a lot.

Collapse
 
shitij_bhatnagar_b6d1be72 profile image
Shitij Bhatnagar

Very nice article and loved the git merge pic/illustration, it's awesome :-D..

Few additional thoughts, one issue that is frequently faced when raising PR/MR is git not picking up history properly (i.e. changes are present in target branch but PR/MR still shows them as delta) and the second issue is that where we expect git to throw up a conflict (e.g. for a value), it may not do that.... so this calls for reasonable due diligence when working with git but again, due diligence is implicit when working with any config management tool anyways.

An additional aspect is that while the above commands are the base set, what code branching strategy is being used in the project also makes for some fun (mistakes, reverts, rebases etc.) in the development team(s), until we get used to one strategy and then the process changes for the next project or phase (e.g. we move from the historical git flow to the more pragmatic GitHub flow and so on).

Thanks for sharing your knowledge on git.

Collapse
 
hadil profile image
Hadil Ben Abdallah

Thank you so much for taking the time to read and share such detailed insights! 😍

You’re absolutely right! Git can be full of subtle surprises, especially when it comes to PR/MR history or conflicts that don’t show up as expected. That’s why I always emphasize pausing, checking, and understanding the state of your repo before making changes; due diligence is critical, just as it is with any configuration management tool.

I also really appreciate your point about branching strategies. The commands are just the foundation; the workflow and strategy a team uses really shape how you interact with Git, and moving between strategies like Git Flow and GitHub Flow can definitely create new learning curves.

Thanks again for adding such a thoughtful perspective! 💙

Collapse
 
peacebinflow profile image
PEACEBINFLOW

This post is clean and honestly needed — because most people learn Git like it’s a haunted keyboard ritual: copy command, pray, ship.

I like the core point a lot: you don’t “master Git,” you master a small set of commands deeply, and that’s what makes you calm under pressure. The “Git remembers everything” framing is also real — Git isn’t judging you, it’s basically your timeline + undo button if you actually use it intentionally.

Only thing I’d add (because real teams = real chaos): the difference between revert vs reset is career-saving, and “check git status first” should be tattoo-level advice. Also shoutout to git diff — it’s the “read before you sign” of code.

Solid write-up. If a beginner reads this and practices these 15 until it’s muscle memory, they’ll stop fearing Git and start using it like what it is: controlled time travel.

Collapse
 
hadil profile image
Hadil Ben Abdallah

This comment genuinely made me smile. Thank you for such a sharp (and painfully accurate 😄) read.

The “haunted keyboard ritual” description is exactly how most of us were introduced to Git, and that’s the pattern I wanted to break. You captured the core idea perfectly: Git calm doesn’t come from knowing everything; it comes from deeply understanding a small, reliable set of commands.

And yes, 100% agree on your additions:

  • revert vs reset really is career-saving knowledge
  • git status first should be non-negotiable
  • git diff as “read before you sign” is one of the best analogies I’ve heard

If beginners walk away practicing these until they’re muscle memory, they don’t just “use Git”, they gain control over it.
Thanks again for the thoughtful breakdown and for adding so much value to the discussion 💙

Collapse
 
aniruddhaadak profile image
ANIRUDDHA ADAK

Very useful

Collapse
 
hadil profile image
Hadil Ben Abdallah

Thank you so much! 😍 So glad you found it useful

Collapse
 
amirhossein_ln profile image
Amir

Great roundup this week 👏
Really enjoyed the mix — from the philosophical take on AI as “software” to very hands-on builds like the ESP32 face recognition and the Excalidraw animation engine.

Posts like these are exactly why I keep coming back to DEV: real problems, real solutions, and thoughtful perspectives.
Big congrats to all the authors featured 👏🔥

Always happy to connect with folks building interesting things in web, AI, and tooling

Collapse
 
hadil profile image
Hadil Ben Abdallah • Edited

Thank you so much, Amir! 💙

Collapse
 
kiran_ravi_092a2cfcf60389 profile image
kiran ravi

the representation is awsome

Collapse
 
hadil profile image
Hadil Ben Abdallah

Thank you! 💙 That really means a lot 😍

I’m glad the representation resonated with you. I tried to reflect Git the way most of us actually experience it; a little intimidating at first, messy sometimes, but very learnable once you slow down and understand what’s really happening.

If it felt clear and relatable, then I’m happy it came across the way I hoped. Thanks for taking the time to read.

Collapse
 
kiran_ravi_092a2cfcf60389 profile image
kiran ravi

♥️

Thread Thread
 
hadil profile image
Hadil Ben Abdallah

😍😍

Thread Thread
 
kiran_ravi_092a2cfcf60389 profile image
kiran ravi

You are my fav dev ever ☺️💗

Thread Thread
 
hadil profile image
Hadil Ben Abdallah

Thank you so much! 🥰🥰🥰

Collapse
 
mezieb profile image
Okoro chimezie bright

Thanks for sharing

Collapse
 
hadil profile image
Hadil Ben Abdallah

You're welcome 😍

Collapse
 
ctechdiva profile image
Cheryl A

great review. Although with AI I am moving through these steps quickly using CLI and leveraging desktop ver of GitHub. But this is where I started

Collapse
 
hadil profile image
Hadil Ben Abdallah

Thank you so much 😍

That makes total sense. AI and modern tooling definitely help move through these steps much faster now, especially with CLI helpers and GitHub Desktop smoothing out the rough edges.

What I really like about what you said is “this is where I started.” Even with better tools, that foundation still matters. When you understand what’s actually happening under the hood, the AI suggestions and UI buttons feel safer and more intentional, not just convenient.

Really appreciate you sharing that perspective 💙

Collapse
 
ctechdiva profile image
Cheryl A

As a reinforcement exercise, I may revisit these skills. When I used them daily, I almost didn't have to think about it. The tools quickly show the commands on the screen before executing, but it's not the same as using them yourself. I actually updated my keyboard recently, and there is something about doing this type of work with a good keyboard that makes the experience more enjoyable.

I will share that one thing I didn't like/still don't was having conflicts. Unfolding it was tedious, so I greatly appreciate the tool that resolves it, especially when there is more than one.

I've been mostly a reader here, but I will definitely be following your content

Some comments may only be visible to logged-in visitors. Sign in to view all comments.