Is there a quick way to accept local version in merge conflict?

Hi,

For reasons that are boring and probably irrelevant, I have ended up with a lot of merge conflicts in my current project.  I know 100% that the local files on my machine are all correct.  Is there a quick way to tell SourceTree/Git that I want to resolve all conflicts by taking the current local version of all the files?

Any help would be very much appreciated.

 

Kind wishes ~ Patrick

 

2 answers

1 accepted

@Patrick Skelton: As you are looking for a recipe to use "mine" for all of your files at once, have a look here:

http://stackoverflow.com/questions/914939/simple-tool-to-accept-theirs-or-accept-mine-on-a-whole-file-using-git

Haven't tested tis recipe - but it looks exactly what you are looking for. Personally I prefer doing it individually - as I don't trust those mass operations, as I'm afraid they might harm anything unexpected... (**PARANOIA**)

Hi, @Johannes Kilian 

Not as paranoid as me after yesterday, when I ended up having to destroy an entire repo and re-add the whole project (effectively wiping its history) because I got in such a mess doing a 3-way merge.  Luckily, I am the only one working on it at the moment, and I keep a 'Release Notes.txt' as part of the project.

Ironically, I think the script above would make me less paranoid.  I knew my local version was correct, so all I wanted to say to SourceTree/Git was, 'Look, I don't care what differences you find, don't touch the current version of files in my project.'

Thanks for the link.

  • Patrick

 

 

 

There are different methods to solve conflicts: Right click on the conflicted file within Sourcetree and you see a drop down menu to access methods resolving conflicts:

SourceTree_2016-03-09_13-44-59.png

There are several methods for resolving conflicts: the one you are interested in is "Resolve using "Mine"

 

Nomenclature:

As I'm are trying to merge "foreign" ("their") changes into "my" repository, the following wording is used:

"Resolve using "Mine"" overwrites the result of the merge with my pre-merge version - their remote changes are ignored.

"Resolve using "Theirs"" overwrites the result of the merge with their pre-merge version - my local changes are ignored

This is a very clear description of what I've always found to be very ambiguous terms.

It's a result of my poor english: describing complicated things with a very small vocabulary. smile

That is a clear explanation.  Thank you.

(I did hope there would be a way to do that for all files, rather than have to do each one individually.)

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

768 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you