7 ms·
I can give you an example of when I am glad I rebased. There have been many times I have been working on a feature that was going to take some time to finish.
by skipkey 8mo ago
I can give you an example of when I am glad I rebased. There have been many times I have been working on a feature that was going to take some time to finish. In that case my general workflow is to rebase against main every day or two. It lets me keep track of changes and handle conflicts early and makes the eventual merge much simpler. As for debugging I’ve never personally had to do this, but I imagine git bisect would probably work better with rebased, squashed commits.
- hnben 8mo ago> I can give you an example of when I am glad I rebased I think the question was about situations where you were glad to rebase, when you could have merged instead
- alemanek 8mo agoThey kind of spoke to it. Rebasing to bring in changes from main to a feature branch which is a bit longer running keeps all your changes together. All the commits for your feature get popped on top the commits you brought in from main. When you are putting together your PR you can more easily squash your commits together and fix up your commit history before putting it out for review. It is a preference thing for sure but I fall into the atomic, self contained, commits camp and rebase workflows make that much cleaner in my opinion. I have worked with both on large teams and I like rebase more but each have their own tradeoffs
- thousand_nights 8mo agoi don't think i have ever even looked at what order the commits are, i only care about the diff vs the target branch when reviewing especially since every developer has a different idea of what a commit should be, with there being no clear right answer
- rendaw 8mo agoYou can bring in changes and address conflicts early with merge too, I believe that's GP's point.
- alemanek 8mo agoYes but specifically with a rebase merge the commits aren’t interleaved with the commits brought in from mainline like they are with a merge commit. EDIT: I may have read more into GPs post but on teams that I have been on that used merge commits we did this flow as well where we merged from main before a PR. Resolving conflicts in the feature branch. So that workflow isn’t unique to using rebase. But using rebase to do this lets you later more easily rewrite history to cleanup the commits for the feature development.
- cluckindan 8mo agoSo use --merges when browsing main.
- tsimionescu 8mo agoYou'll still get interleaved commits. If I work on a branch for a week, committing daily and merging daily from main, when I merge to main, git log will show one commit of mine, then 3 from someone else, then another of mine, etc. The real history of the main branch is that all my commits went in at the same time, after seven days, even if some of them were much older. Rebase tells the real story in this case, merge does not.
- cluckindan 8mo agogit log --oneline --graph --first-parent
- cryptonector 8mo agoThat's hard to answer because I only rebase.
- bluGill 8mo agoI used hg (mercurial) before git. Every time I see someone make an argument like yours I think "only because git's merge/branch model is bad and so you need hacks to make it acceptable". Git won, which is why I've been using it for more than 10 years, but that doesn't mean it was ever best, it was just most popular and so the rest of the eco system makes it worth it accepting the flaws (code review tools and CI system both have much better git support - these are two critical things that if you use anything else will work against you).
- doctorpangloss 8mo agoNot only is git not the best, but one of the central value props of coding agents and chatbots used for programming is not having to use git in order to interact with free code.
- jason_s 8mo agoSigh. I will forever hate Atlassian for killing Bitbucket hg hosting. What code review tools do you prefer?
- BeetleB 8mo agoI do the same except with merge. I don't see how rebase makes it any better.
- gaoshan 8mo agoFWIW I have used git bisect with merged commits and it works just as well (unless the commit is enormous... nothing like settling on a sprawling 100 file change commit as the culprit... good argument for discrete commits, but then it wouldn't matter if it were rebased or merged)