cshannon commented on PR #3510: URL: https://github.com/apache/accumulo/pull/3510#issuecomment-1601625547
> > In this case I did merge using -X ours and I ended up fixing things in the merge but next time I'll just do the fix in another PR after the merge. > > `-X ours` is not the same as `-s ours`, and `-X ours` should be done very carefully, because it can still make changes to the destination branch. The `-X` version is a merge strategy **option** to the default merge strategy (which can vary from one git version to another). Typically, `-X` option says `merge using the default strategy, but select 'ours' when there's a conflict`. That's not usually what we want. The `-s` changes the entire merge strategy. Typically when we're merging this way, we want the destination branch we are merging _into_ to be untouched by the merge... we want to connect the history only, but we want to keep the current code. That's when you should select the `-s ours` merge _strategy_, rather than the _option_ on the default strategy. Usually, you should avoid `-X`, because otherwise, you'll have to try to figure out what it changed and what it kept... and it's not always obvious how to fix the conflicts it creates (and it's easy to overlook them). I find `-X` to result in far more merge bugs. Makes sense, in this case I wanted a couple of changes except for the TabletFile changes so using -X brought that over but it was annoying going through and fixing everything. Next time I definitely plan to just use `-s ours `and just skip and re-implement the commit entirely as it would be easier. I'm used to using -X as a force of habit for merging forward things that just have version conflicts as it is handy for that. One thing I thought of is if you use `git merge -s ours` does it only skip conflicting commits or will it not bring in any commits? Would it sill merge in commits from the source branch that merge cleanly? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
