DEV Community

Cover image for The One Git Command I Use Every Single Day (And It's Not git push)
Shahzaib
Shahzaib

Posted on

The One Git Command I Use Every Single Day (And It's Not git push)

I see junior developers pushing code to main directly. I did the same thing for way too long.

Now I use one command more than any other:
git rebase --interactive HEAD~3

Before I push any branch, I rebase my last 3 commits and squash the "fix typo" and "wip" commits into one clean commit.

This changes how I work:

  • My commit history is readable (not a mess of "oops" messages)
  • My PRs are smaller and easier to review
  • I think more carefully before I commit

It's not a flashy skill. But it's the one that made me look more professional than any framework I learned.

What's one Git command or workflow that made you feel like you actually knew what you were doing?

My full stack (and my clean commit history): My Portfolio

Top comments (1)

Collapse
 
linkdesink profile image
Emmanuel Chekwube

I still have a long way to go in this programming carrer

Collapse
 
shahzaib-tech profile image
Shahzaib

Thanks for the comment Emmanuel! We all start somewhere. I was exactly where you are 6 years ago, making messy commits, pushing straight to main, and hoping nothing broke.

The git rebase workflow wasn't something I learned overnight. It came from making the same mistakes over and over until I found a better way.

You're already ahead by being here and reading. That's the first step.

If you ever want to bounce a Git workflow question, feel free to reach out. We've all been there.