gitgithubmergebeyondcomparebeyondcompare4

Git merge with beyond compare


I've recently purchased beyond compare pro to merge code shared with git (of which I have a very limited understanding). I now have two branches, a master and a feature. I recently pulled the master from remote so that now the master is a few commits ahead of the common ancestor between master and feature.

Since my branch feature has mostly deletions I want to merge master into feature and not the reverse (does this make sense?). So I basically did

git checkout master
git pull origin master
git push origin master

So at this point my feature is a few commits behind and a few commits ahead of master. To merge the commits of master into feature I did:

git checkout feature
git merge master
git mergetool

Now I'm prompted with a series of messages like

Deleted merge conflict for 'ED/build/make/rules.mk':
  {local}: deleted
  {remote}: modified file
Use (m)odified or (d)eleted file, or (a)bort? m

Normal merge conflict for 'ED/src/driver/ed_model.F90':
  {local}: modified file
  {remote}: modified file
merge of ED/src/driver/ed_model.F90 failed
Continue merging other unresolved paths [y/n]? y

All other files give a failed merge error without even opening the beyondcompare mergetool to do the merge.

EDIT

The relevant part of my .gitconfig is

[diff]
    tool = bc3
[difftool]
        prompt = false
[difftool "bc3"]
    trustExitCode = true
[core]
    fileMode = false
    symlink = false
    ignorecase = true
[merge]
    tool = bc3
[mergetool "bc3"]
    trustExitCode = true
[alias]
    difftool = difftool --dir-dif --no-symlinks

Solution

  • The first prompt says (m)odified or (d)eleted, does this mean that I have to choose which file to select between local and remote as a result of the merge?

    Yes. Probably you want to choose the (d)eleted state, assuming you wish those files to remain deleted in your feature branch and don't care how they may have been changed since you originally deleted them.

    Typically your master is intended to be in sync with the remote at all times. Local changes such as deleting files are properly done in a feature branch as you are doing, so that's good. If your changes are purely local, never intended to become a permanent part of the main project, then they stay in the feature branch forever, and you occasionally merge from master to feature whenever you pull fresh updates from the remote, exactly as you are doing. The only time you want to merge back from feature into master and then push is to change something for everyone using the project.

    The second prompt tells me that the merge failed, why is this happening?

    If the answer to any of these is "no" then you return to git with merge markers still in the file, which means "I didn't finish". In other words, that merge "failed", meaning it did not get completely finished successfully.

    I wouldn't worry about the file addresses looking wrong. When git attempts to resolve a merge, it copies the three different versions (remote, local, merged) into three temporary files. When you're done editing and merging, it copies the 'merged' one back into your local file.

    All other files give a failed merge error without even opening the beyondcompare mergetool to do the merge.

    This seems strange. Typically git will continue one by one. Sorry I can't be of more help here.