4 ms·
> And do you seriously not see the need of rebasing? Git user for a decade. I never rebase, not professionally and not in my personal projects. I merge the wor
by dotancohen 4y ago
> And do you seriously not see the need of rebasing?
Git user for a decade. I never rebase, not professionally and not in my personal projects. I merge the work of other devs, no matter how ugly their history.
I don't see any real problem that rebase solves, but I do see that it mangles history and makes troubleshooting e.g. git bisect much more difficult.
- oivey 4y agoRebasing other’s stuff feels gross since it is altering externally visible history. Rebasing your own stuff before you push can make commits more clear, understandable, and meaningful. git pull —rebase is pretty unobjectionable. How does rebasing break bisect?
- CuriousCosmic 4y agoPresumably they are referring to how the `--first-parent` flag works as it only uses the head of the branch from a given merge instead of including each commit from the merge. Some projects prefer rebasing onto master instead of merging onto master or squashing onto master. If you rebase onto master but don't clean up the commits at the end of the PR, this litters master with a bunch of "top level" commits that don't build and cause git-bisect's test to fail due to those commits not working in the first place. If you rebase onto master but you do clean up your commits such that each commit onto master represents a fully functional version of the project, this isn't a problem however it can make a bisect take way longer than if just merge commits are tested. If you are rebasing to this degree, I don't really understand the purpose of the rebase for a feature or issue branch (as to this degree, the last commit is the only "completed" commit of this type of branch and you are effectively squashing). It makes sense for say a release branch so you can integrate hotfixes/patches but that workflow can be just as if not more effectively handled via a merge or a squash as well.
- oivey 4y agoMakes sense. I guess I just implicitly assumed the workflow of rebasing personal stuff and usually merging externally visible stuff.
- account42 4y ago> it can make a bisect take way longer than if just merge commits are tested. The whole beauty of bisect is that is a binary search where if you double the number of commits you only need to do ~1 additional check. So no, it can't take "way" longer. And it's not like you'd call it a day after finding the merge commit that breaks things - you then need to find the actual problem with that branch and the fastest way to do that is bisecting down to the individual commit so you are actually doing the same work but artificially restricting git bisect from evenly dividing the search space by restricting it to merge commits first.
- 5e92cb50239222b 4y agoYou must not ever work with junior developers. Rarely do I see a properly created commit history, what you usually get is something like: add upd fix upd fix Rebasing that stuff before merging it into master feels mandatory, or you're left with history with a very low signal-to-noise ratio.
- CuriousCosmic 4y agoThat or you are stuck with somebody fighting CI or issues that aren't reproducible in their environment. It's not necessarily a junior dev issue and can just be "our tooling sucks and management refuses to invest time or money into fixing it". It's not an ideal or sustainable work environment but it's something that even senior devs still have to deal with. Of course that should still be rebased down to a reasonable history.
- dreamcompiler 4y agoThe solution for this is not rewriting history but writing a smarter history viewing tool that filters out the noise.
- menaerus 4y ago> what you usually get is something like: That's like 9 out of 10 people in my experience and none of them are juniors. It's pretty hard to get developers more disciplined.
- dotancohen 4y agoIf that's the case, I would have the dev go rebase that into a nice single commit. Not the guy doing the integration work. I expect that the dev's last operation was to merge from the dev branch, fix conflicts, then push a PR. At the least, if you're dev refuses to give you a nice commit, you could merge-squash his branch.
- rhdunn 4y agoOn some projects I maintain a set of local fixes that I regularly rebase on top of the latest code. I don't need to run a bisect on those. I've also managed other projects/branches like you have, merging the changes into my work. I also use the cherry picking feature (which rebase builds on) a lot. That is for things like creating hot fixes, pulling in some upstream patches to my local fixes, reordering a branch, etc.