2

We configure our app version in multiple Maven pom.xml files as:

<version>8.1.0.4-SNAPSHOT</version>

This is always a pain to handle when merging as you will always have conflicts which require manual merging. Can you configure Git to always keep the local copy of the <version>...</version> line when doing a merge?

Note we don't want to simply ignore all remote changes to the pom.xml files as there could have been non <version> changes we want to merge in. We only want to ignore changes to the <version> tag.

Note: It has been mentioned that Can git ignore a specific line? is a possible duplicate. I don't see any mention of merging in that question. Would appreciate someone describing how that translates to merging.

Community
  • 1
  • 1
Marcus Leon
  • 55,199
  • 118
  • 297
  • 429
  • possible duplicate of [Can git ignore a specific line?](http://stackoverflow.com/questions/6557467/can-git-ignore-a-specific-line) –  Jul 06 '15 at 20:19
  • What about this one? http://stackoverflow.com/questions/5587626/git-merging-within-a-line. Particularly the second answer with the merge and smudge pieces – JHowIX Jul 06 '15 at 20:48
  • @Marcus the question might not _mention_ merging but the procédé is implicitly a merge (treating local changes in the face of incoming revisions). I think the duplicate is spot on, really. – sehe Jul 06 '15 at 23:09
  • Sorry what does procédé mean? :) I'd love it if someone could spell it out as an answer here. I'm guessing others are looking for a clear statement of the solution as the question has a couple up votes. – Marcus Leon Jul 07 '15 at 10:58

1 Answers1

1

If you have a repository enabled with git config rerere.enabled=true then it will remember the resolutions you have done and re-apply them next time you have to do them. You can also apply this for all repositories with git config --global rerere.enabled=true

AlBlue
  • 23,254
  • 14
  • 71
  • 91