How to use BeyondCompare from git mergetool in cygwin?

How to use BeyondCompare from “git mergetool” in cygwin?

  • Git Diff with Beyond Compare
  • git show commit in beyond compare
  • How to configure Beyond Compare 3 for Eclipse conflict resolution?
  • How can I import a directory structure into SVN, keeping the file and folder modifed dates the same?
  • git difftool to give directory compare?
  • How to configure Beyond compare with Git command line
  • How to determine if Git handles a file as binary or as text?
  • Why would my local changes in Git be overwritten by checkout in this circumstance?
  • How to Get Commits Within a Time Period by an Author
  • Git: Can I commit my working directory to a new branch without committing it to a current branch?
  • Conflict between branch and file completion in bash/git
  • Authentication for git-bitbucket
  • 2 Solutions collect form web for “How to use BeyondCompare from git mergetool in cygwin?”

    Here’s a simple answer.

    #! /bin/sh
    LOCAL=`cygpath -wa $1`
    REMOTE=`cygpath -wa $2`
    BASE=`cygpath -wa $3`
    MERGED=`cygpath -wa $4`
    /cygdrive/c/BeyondCompare3/BComp.exe $LOCAL $THEIRS $BASE $MERGED
    

    Or as in your git config.

    [mergetool "mergetool"]
        cmd = /cygdrive/c/BeyondCompare3/BComp.exe `cygpath -wa "$LOCAL"` `cygpath -wa "$REMOTE"` `cygpath -wa "$BASE"` `cygpath -wa "$MERGED"`
    

    I use cygpath (which comes with cygwin) to convert the paths. The -w flag converts from cygwin format (starting with /cygdrive/c) to windows format (starting with c:). The -a flag uses absolute filenames.

    Note: I don’t have a Pro BeyondCompare license, so I can’t test merge properly, but it is correctly opening the first two files.

    I’ve found some scripts to convert cygwin paths (robustly, it seems) and launch BC3:
    http://gist.github.com/564573

    Git Baby is a git and github fan, let's start git clone.