News for hackers. Stuff that matters.
Re:Julia Evans: Git rebase, what can go wrong by nomel on Monday November 06, 2023 @01:49PM (#38166938)
How is this possible, while sharing code? Doesn't this require that pushed code is perfect? What about everyone else working on the same code? Do they wait until you've reached perfection? Or, do you squash the branch once it's complete, with the assumption that there's no other development on/from that temporary branch (I envy you if so)?

(I ask these questions fully assuming I'm doing it wrong.)

Re:Julia Evans: Git rebase, what can go wrong by dahart on Monday November 06, 2023 @02:02PM (#38167134)
> Doesn't this require that pushed code is perfect?

We aren’t talking about pushed code. We are talking about cleaning up the local commit history before pushing it into a shared branch.

Re:Julia Evans: Git rebase, what can go wrong by nomel on Monday November 06, 2023 @03:05PM (#38168154)
What about the context where one works with other people, while sharing code?
Re:Julia Evans: Git rebase, what can go wrong by hhjinks on Monday November 06, 2023 @03:33PM (#38168570)
You fix your local tree before sharing it. Alternatively, you can communicate with your team and tell them they'll need to run git fetch && git rebase -i origin/main to drop your erroneously merged commits.
Re:Julia Evans: Git rebase, what can go wrong by dahart on Monday November 06, 2023 @04:27PM (#38169260)
When working with published/shared branches with other people, the advice with git has always been that history is history and not to be changed after publishing, unless there is an emergency like a security incident.

Aside from that we need might need to clarify what the question is. With shared code & git, it’s nice to use a branch & merge workflow, and it’s nice to make incoming merges as clean / nice as you can do the resulting history is as smooth as it can be while capturing what happened at a reasonable granularity. These are today’s conventions though, and it’s really up to the team to decide how to balance shared work, and what people feel are the most important workflows and tools.

Re:Julia Evans: Git rebase, what can go wrong by sidlls on Monday November 06, 2023 @06:13PM (#38170572)
And that's the one--and only--reasonable use of rebasing, to squash commits from a branch before merging into main. If engineers find themselves using rebase in any other context than squashing a merge, it's time to re-evaluate the processes/culture around workflow.