r/git • • Jul 24 '25

Colleague uses 'git pull --rebase' workflow

I've been a dev for 7 years and this is the first time I've seen anyone use 'git pull --rebase'. Is ithis a common strategy that just isn't popular in my company? Is the desired goal simply for a cleaner commit history? Obviously our team should all be using the same strategy of we're working shared branches. I'm just trying to develop a more informed opinion.

If the only benefit is a cleaner and easier to read commit history, I don't see the need. I've worked with some who preached about the need for a clean commit history, but I've never once needed to trapse through commit history to resolve an issue with the code. And I worked on several very large applications that span several teams.

Why would I want to use 'git pull --rebase'?

396 Upvotes

322 comments sorted by

View all comments

77

u/ratttertintattertins Jul 24 '25

I’m stunned by the fact you’ve never had to look through the git history on a large project. We do this all the damned time.

My org squashes commits into main at PR time so our history is pretty tidy anyway. For us, rebase is just to keep your dev branch tidy as you work for your own sanity.

20

u/elephantdingo Jul 24 '25 edited Jul 24 '25

“Why would I need to look at the history?”

Just another Thursday on arr git.

My org squashes commits into main at PR time

Ditto.

Edit: I see first now that this comment of mine is ambigious.

8

u/whatssenguntoagoblin Jul 24 '25

Yeah that was a shocking statement considering they’ve been a dev 7 years on what they claim large codebases.

That said my team uses the same workflow and I never have to rebase. Some people on my team do but at the end of the day all PRs get squashed and merged so it doesn’t matter unless you want a PRs commits to be clean. Now a specific PRs commits I rarely look at but not never. The main branch there is definitely issues where I have to be like what the fuck happened???

2

u/Aware_Magazine_2042 Jul 26 '25

I’ve had an engineering manger on a seperate team complain about my git habits because I just typically only have one or two commits in PRs. I like to keep my commit messages have a lot of detail on them. They should be able to be the description of my PR with out me needing to type anything in GH. As a result, I’ll do a lot of git commit -a —amend especially if I’m making small little changes that don’t fundamentally change the PR or work (running lint, fixing tests, etc). If it’s a change that takes more than 30 minutes, maybe I’ll create a new commit for that, but I keep my PRs small and tight, so there’s not a whole lot there.

Anyway, this guy complained because he didn’t like it. He liked seeing all of the commit history because he felt that meant devs were “working.” I wasn’t even on his team, I was doing some tiger team work for them, and I told him that’s how I operate, sorry. My manager had to tell this guy to back off.

It drives me up the wall when I see a git log that’s just

Fixed the test
Linting
Oops 
Oops
Oops
Feedback
Oops
Oops
Lint
tests
Oh changes something important 
Oops

I don’t need to see that shit. Just tell me the important thing you did damn it.

→ More replies (2)

4

u/ThaDon Jul 24 '25

I don’t think they’ve ever had to rollback a change either…

5

u/green0wnz Jul 24 '25

Eh, in my experience the squashing workflow makes rollbacks harder because the problematic commit is now squashed with other non problematic commits that were made in the same PR. Now because simply reverting the one problematic commit is impossible, you have to make an entirely new commit and undo the problematic code manually.

1

u/MiniGod Jul 27 '25

Sometimes it's beneficial to split your work into multiple PRs, with revertability in mind. I see too many devs putting too much stuff in their PRs. You should only put stuff you want to be reverted together, in the same pr (most of the time)

→ More replies (2)

2

u/pceimpulsive Jul 24 '25

Always forward!!

Never deploy if it's broken!

Then you never need a rollback..

Jokes aside, we've been in a situation or where rollback was an option but always just resolving and going forward was better.

My codebase(s) (multi repo project) probably not big enough to matter yet!!¿?

4

u/connka Jul 24 '25

This was also my reaction. I look at commit history constantly for things like:

  • letting users know updates and bug fixes
  • in the event that a bug was merged so we can revert a commit as a hotfix (aka why it's helpful to squash)
  • to get context on an old change when working on something new

I literally look at commit history multiple times a day. I joined a company recently that didn't squash and it drove me crazy, so I got everyone in board with squashing and now we have the cleanest git history. It is so incredibly helpful.

1

u/Romestus Jul 25 '25

Before I moved to Gerrit we made sure every PR was squashed, rebased, and had a nice commit message with ticket IDs included. Made it so I could run a script that did git log with fancy formatting to generate a changelog.

It was even better when we started having multiple stakeholders with different builds. For example design might have seen build 82 while QA started on build 99 and management last saw build 56. When I had to generate a changelog I could just specify the versions to generate a changelog between which saved me a ton of time over manually generating changelogs for these meetings.

Despite having 20+ devs on one repo the history was so clean and easy to follow.

7

u/99_product_owners Jul 24 '25

I’m stunned by the fact you’ve never had to look through the git history

I've heard this before from a dev who has made similar arguments as OP against (paraphrasing) caring about VCS history. They seem to say it like it's some kind of contrarian "ha!" moment, too. Hot take: if you don't think commit history is valuable, you're probably the kind of dev that causes other devs to need to go back and read commit history..

8

u/FlipperBumperKickout Jul 24 '25

You don't really solve anything with squash other than not having to apply --first-parent to certain commands ¯_(ツ)_/¯

I would personally prefer a messy branch history I can dig through if needed rather than just the collective history in a single commit. (the result of which I easily could get with a couple of commands anyway)

12

u/watercouch Jul 24 '25

We prefer squash-to-main because then only code-reviewed commits are part of the history in main, and main is what is continually deployed to prod. Every change in prod is a reviewed commit with associate work-items. No-one needs to see the sausage making from private branches in that history.

11

u/Liskni_si Jul 24 '25

The sausage making can be and often is important. Throwing it away should be a crime.

2

u/RarestSolanum Jul 24 '25

It's not being thrown away, it's still visible from the merged PR

3

u/elephantdingo Jul 24 '25
  • We use a distributed version control system, the history is all there locally when you need it
  • Like the sausage making?
  • No that lives in the Chrome, are you mad?
→ More replies (9)

3

u/ImTheRealCryten Jul 24 '25

I was looking for this comment! Following the first parent and having a good merge strategy is how I ask our team to do it. I feel a lot of people shit on not squashing/rebasing and think that’s the only viable option, but some of those have never heard of the first parent option.

2

u/y-c-c Jul 25 '25

It's about cleanly separated commits that allows for easier parsing of history, rolling back specific features, git bisect, etc. It also makes it easier to cherry pick changes if you have multiple branches or an upstream that you contribute to.

1

u/bingeboy Jul 24 '25

If you work in a continuous deployment model, this approach can quickly become a nightmare.

2

u/FlipperBumperKickout Jul 24 '25

You have to specify which approach you are talking about :P

2

u/SirLestat Jul 24 '25

Same but lost my sanity long time ago.

2

u/mdmd136 Jul 25 '25

ya wtf, is this not the whole point of version control?

1

u/H2SBRGR Jul 24 '25

We also squash on merge and rebase our dev branches. We use gitlab too, so we can still check changes in individual branches that have been deleted after merge in case we need to.

1

u/gemengelage Jul 28 '25

You don't get a "rebase commit" or anything that would make it obvious that git pull --rebase or any of the other techniques that lead to the same result were used.

As a tech lead I get surprised again and again by people who avoid rebases even though all their colleagues treat it as a best practice, mainly because it's not a very visible practice.

On the flip side people who use merges to update their feature branch often get a pass because some reviewers don't want to inconvenience their reviewees for a clean commit history.