Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Auto resolve a merge conflict on specific files in a pull request? (git merge driver?)

Andreas Borkenhagen March 19, 2014

I want to resolve conflicts on a pom.xml merge by taking always the version of the destination branch. In plain git this would be possible with a merge driver.

How can i realize this with on a stash pull request?

10 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Jan Krueger October 19, 2014

How did you configure stash to use your custom merge driver?

0 votes
Cecom March 10, 2015

Hi,

i wrote an java merge driver, which you can configure. Right now it adjust's the parent and project version and only them (no xml structure or dependency version changes). If you want, you can auto resolve property conflicts too. Have a look on my project on github. 

Greetings,
Sven

0 votes
Jan Krueger October 19, 2014

Thanks, Andreas! Works like a charm!

0 votes
Agustin Martin October 19, 2014

This is great news, that way I can reuse my own merge driver too. Thanks Andreas! I guess you answered your own question.

0 votes
Andreas Borkenhagen October 19, 2014

You don't need to configure Stash. Stash uses the standard Git installation so you only need to configure your Git / the Git config of the user that runs Stash.

0 votes
Mike Friedrich
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 12, 2014

Have you tried using a .gitattributes file to specify merge a strategy for this file?

https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

I would assume that works without any driver.

Andreas Borkenhagen October 12, 2014

I would like to see that merge strategy...

Agustin Martin October 12, 2014

It's not that easy. Sometimes you want to do a normal merge except for the project version. Thus the merge driver

0 votes
Agustin Martin September 18, 2014

If you have perl 3 on the server you could try the merge driver I'm using: https://github.com/agusmba/pom-merge-driver It works by changing my local pom version to the meging one in order to avoid conflicts, but reverts the change after the merge (before the commit). Only when merging to the "master" brach does the merge driver keep the new pom version instead of reverting to the previous one. Please note that I did not write the driver, only modified it to meet my needs, and I'm in no way a perl expert.

0 votes
Andreas Borkenhagen September 18, 2014

I managed to implement and install a mergedriver that takes the version from to local pom and writes it in the other pom.xml before it executes git merge-file but ran into another problem: https://answers.atlassian.com/questions/8618847

0 votes
Agustin Martin September 18, 2014

have you tried to install the custom driver on your stash server (and stash user)?

0 votes
Agustin Martin September 16, 2014

I come from fixing many of my pom.xml problems via a custom merge driver, so this is indeed a good question.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events