TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Avoid Most Rebase Conflicts

55 pointsby kantordover 5 years ago

10 comments

xg15over 5 years ago
&gt; <i>So to relieve some of that tension and ease up the final merge you’re heading towards, you decide to perform a control merge now and then: a merge of master into your own branch, so that without polluting master you can see what conflicts are lurking, and figure out whether they’re hard to fix.<p>It is indeed useful, and just so you won’t have to fix these later, you would be tempted to leave that control merge in the tree once you’re done with it, instead of rolling it back with, say, a git reset --hard ORIG_HEAD and keep your graph pristine.</i><p>if you use git &quot;linear history&quot; style and will do a rebase at the end anyway, why not do &quot;control rebases&quot; immediately, instead of control merges?<p>At least from my experience, a rebasing on a branch that has substantially diverged can get painful quickly, however doing many small rebases and trying to keep up with master usually works without many problems.
评论 #20861717 未加载
评论 #20862225 未加载
评论 #20861741 未加载
derrizover 5 years ago
Once I read &quot;this is ugly and pollutes your history graph&quot; as a justification for any git feature, I&#x27;m immediately turned off.<p>What really is wrong with having a graph that actually reflects the real history of changes as they were made at the time?<p>Why not keep things simple and improve git-log so that anything you find ugly or that looks like pollution can be hidden while viewing the history of a repo? In this case, for example, would it not be far more ergonomic to add a &quot;--hide-control-merges&quot; flag to git-log?<p>This rerere feature described looks like a lot of the foot-guns git provides.<p>I know I&#x27;m in a minority here - I&#x27;ve given up arguing with collegues that it&#x27;s possible to have a branch&amp;merge work-flow without constant re-basing. Allowing the history graph to be manipulated and changed seems to have become part of the most popular git work-flows even though it&#x27;s a recipe for serious pain in a distributed VCS.<p>(This isn&#x27;t a criticism of the article btw - more of the git design&#x2F;philosophy.)
评论 #20861665 未加载
评论 #20861629 未加载
评论 #20861439 未加载
评论 #20861513 未加载
评论 #20863054 未加载
aaronbrethorstover 5 years ago
I would settle for more clear definitions of “mine” and “theirs.” Bonus points if the definition doesn’t change based on the action I’m performing.
werpersover 5 years ago
What is the problem with the graph in the first figure?<p>Apart from looking a little bit more complicated than one without the merges, will a history like that actually cause any probelms?
评论 #20861279 未加载
评论 #20861693 未加载
rurbanover 5 years ago
I&#x27;m doing that successfully for years. But I added more: <a href="https:&#x2F;&#x2F;github.com&#x2F;perl11&#x2F;cperl&#x2F;blob&#x2F;master&#x2F;pod&#x2F;perlcperl.pod" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;perl11&#x2F;cperl&#x2F;blob&#x2F;master&#x2F;pod&#x2F;perlcperl.po...</a><p>The .git&#x2F;cache is a submodule, so others can easily rebase also. And a lot of helper scripts to rebase and pull --rebase all work branches automatically. All current branches are constantly rebased to master, others default to pull --rebase (aliased to lb), with the shared. git&#x2F;cache there are no conflicts for years.<p>I&#x27;m also doing this for several forks automatically, like adding patches and CI smokes to popular repos like clisp, libffi, openssl, pcre2, coreutils and many more. These are rebased hourly, conflicts appear maybe once a year.
jayd16over 5 years ago
Just leave the damn control merges in the history. It&#x27;s what happened after all...
评论 #20861354 未加载
dahartover 5 years ago
This was a nice read; git rerere is one of the git features that has been a tad mysterious for me, I thought it was on by default.<p>I’m pretty sure I’ve used it, probably because I read somewhere, just like this article says, that it should be turned on by default. What I didn’t know and wondered while reading is how to clear a rerere, and it looks like you can “git rerere [clear|forget]”. <a href="https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-rerere" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;docs&#x2F;git-rerere</a> I have resolved a conflict and then discovered later that I screwed it up, so needed to do it again.
jrochkind1over 5 years ago
This seems like a very useful feature, and I don&#x27;t want any more new git commands&#x2F;workflows to have to remember.
twicover 5 years ago
I already know how to use push --force to do that.
评论 #20861194 未加载
shlokjoshiover 5 years ago
Interesting article