I want the 'merge' function completely deprecated. I simply don't trust it anymore. If there are no conflicts, you might as well rebase or cherry-pick. If there is any kind of conflict, you are making code changes in the merge commit itself to resolve it. Developer end up fixing additional issues in the merge commit instead of actual commits. If you use merge to sync two branches continously, you completely lose trac…
Rebasing is a tool of last resort, when something has so fowled up the code that merging a large-scale refactor is even more time consuming. Rebasing takes longer and is actually more prone to error because of the clunky interface. There is absolutely nothing wrong with squashing commits in a feature branch and merging that into master/main. In fact, it's generally better for the health of the repo and the mental hea…
Extremely Linear Git History
271–280 of 366 posts
Re: Extremely Linear Git History
#272Earlier quoted context omitted.
> It seems like a very contrived example to me. I run in to this quite frequently, even on projects where I'm the only one working on it (I tend to have a lot of things going on in parallel). Once branches diverge and commits accumulate it can become a right pain. Usually my solution is to merge master into the branch just to keep up to date and then just undo everything, make one new commit in the master, and rebase…
> arguably I shouldn't have all these long-lived branches in the first place This is the problem here. If you have multiple long-lived branches, there's no technical solution to preventing rot -- you must actively keep them in sync. Regularly merging in main is the opposite of the proper solution. Constantly rebasing on top of main is the proper solution.
> If you have multiple long-lived branches, there's no technical
> solution to preventing rot -- you must actively keep them in sync.
Rebasing isn't an alternative to this, it's just a different way of
manually keeping in sync. > Regularly merging in main is the opposite of the proper solution.
> Constantly rebasing on top of main is the proper solution.
Why? You've given no justification for your preference.Re: Extremely Linear Git History
#273Earlier quoted context omitted.
> arguably I shouldn't have all these long-lived branches in the first place This is the problem here. If you have multiple long-lived branches, there's no technical solution to preventing rot -- you must actively keep them in sync. Regularly merging in main is the opposite of the proper solution. Constantly rebasing on top of main is the proper solution.
> If you have multiple long-lived branches, there's no technical > solution to preventing rot -- you must actively keep them in sync. Rebasing isn't an alternative to this, it's just a different way of manually keeping in sync. > Regularly merging in main is the opposite of the proper solution. > Constantly rebasing on top of main is the proper solution. Why? You've given no justification for your preference.
I never said it was, I said it was the right way to keep them in sync.
> Why? You've given no justification for your preference.
I don't need to, the GGGGP said it perfectly: https://news.ycombinator.com/item?id=33705026
Re: Extremely Linear Git History
#274Hail p4, g4, svn and blessed be their monotonically increasing revision number!
Re: Extremely Linear Git History
#275Earlier quoted context omitted.
> I want the 'merge' function completely deprecated. I simply don't trust it anymore. Merge is perfectly fine and it is the only way to synchronize repositories without changing the history, which is very important for a decentralized system. It certainly has the potential to make a mess if used improperly, but so do rebase, cherry-pick, and basically every other command. > If you use merge to sync two branches conti…
way easier to mess up a rebase
Re: Extremely Linear Git History
#276Earlier quoted context omitted.
Totally on board (except the forbidden -a switch). The last command is: cp .git/refs/heads/feature .git/refs/heads/main No merge needed.
Touching files in .git (outside of like, .git/config) directly gives me the heebee jeebees
Re: Extremely Linear Git History
#277Re: Extremely Linear Git History
#278Earlier quoted context omitted.
way easier to tell that you've messed up a rebase
it's actually way easier to accidentally mess up a rebase, especially if rearranging commits. I can recommend git diff @{1} post rebase I alias it to d-
I've never seen a rebase gone awry introduce production bugs, but I've known multiple gnarly bugs caused by errant merges. YMMV.
Re: Extremely Linear Git History
#279Github-style rebase-only PRs have revealed the best compromise between 'preserve history' and 'linear history' strategies: All PRs are rebased and merged in a linear history of merge commits that reference the PR#. If you intentionally crafted a logical series of commits, merge them as a series (ideally you've tested each commit independently), otherwise squash. If you want more detail about the development of the PR…
The kernel needs a highly-distributed workflow because it's a huge organization of loosely-coupled sub-organizations. Most commercial software is developed by a relatively small group of highly-cohesive individuals. The forces that make a solution work well in one environment don't necessarily apply elsewhere.
Re: Extremely Linear Git History
#280Sane revision numbers are among the many reasons I prefer SVN to GIT.
You could automatically tag each uploaded commit with a number drawn from a sequence - using a git post-update hook. The only problem is that this centralizes the process. It's not possible to have fully "blessed" commits without pushing them first. And that's how SVN works, too.
In the hook:
prefix=whatever
old=$(git rev-parse HEAD)
new=$(brute force $prefix)
git update-ref -m "chose prefix $prefix" --create-reflog HEAD "$new"
Of course, it's pretty silly and slow.