Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Beyond Compare - automatically merge "conflicted" files in working copy (if possible)

I have recently merged two branches in Git. They were both in development for too long, and hence have a lot of files that were changed on both branches, so Git has marked them as "Conflicted"

As soon as I open them in Beyond Compare, there are "no more conflicts" because its smart enough to sort out the supposed conflict. So its just a matter of open in External Merge Tool (from SourceTree) and then click Save. However, there are a lot of files that need this! Is there a way of getting Beyond Compare to "batch" process all conflicted files in my working copy?

UPDATE

My project's \.git\config file specifies the following, which I believed would force Beyond Compare 4 (Pro) to auto-merge the files, but it does not. Possibly an invalid config? I have triple checked it :(

[diff]
    tool = bc4
[difftool]
    prompt = false
[difftool "bc4"]
    path = /c/Program Files/Beyond Compare 4/BComp.exe
[merge]
    tool = bc4
[mergetool]
    prompt = false
    keepBackup = false
[mergetool "bc4"]
    cmd = /c/Program Files/Beyond Compare 4/BComp.exe -automerge -ignoreunimportant -reviewconflicts "$LOCAL" "$REMOTE" "$BASE" "$MERGED" 
    trustExitCode = true
like image 633
Jimbo Avatar asked Oct 27 '25 09:10

Jimbo


2 Answers

If you have the pro version, you can pass bcompare the -automerge switch as shown on this page.

like image 171
adzenith Avatar answered Oct 30 '25 00:10

adzenith


I have Beyond Compare 3 Pro, and this works for me:

[mergetool "BeyondCompare3"]
path = C:/Program Files (x86)/Beyond Compare 3/bcomp.exe
cmd = \"C:/Program Files (x86)/Beyond Compare 3/bcomp.exe\" "-automerge -ignoreunimportant -reviewconflicts" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"

This will make Beyond compare auto merge, not display the GUI if successful, ignore unimportant differences such as white space. It will only pop up the GUI if a conflict is found.

like image 30
user1970723 Avatar answered Oct 30 '25 00:10

user1970723