Announcement

Collapse
No announcement yet.

Anyone have luck setting up with git?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Anyone have luck setting up with git?

    I tried following the instructions for Linux here http://www.scootersoftware.com/support.php?zz=kb_vcs

    with git-diff-wrapper.sh

    #!/bin/sh
    open "$2" "$5" -a "/Applications/Beyond Compare.app/"

    It just opens to the main beyond compare screen though.

    Has anyone else gotten it set up?

    Thanks,
    Danny

  • #2
    Git Diff Settings

    First, within Beyond Compare, in the menu go to: Beyond Compare > Install Command Line Tools.

    Now that that is set, create a wrapper:

    Code:
    #!/bin/sh
    "/usr/local/bin/bcomp" "$2" "$5" | cat
    Then, within my
    Code:
    ~/.gitconfig
    file, I have:

    Code:
    [diff]
      external = ~/bin/git-diff-wrapper.sh
    NOTE: Replace that path with your specific path.

    I don't have a merge situation yet, but these are the settings I'm going to try for that:

    Code:
    [merge]
      tool = bc4
    [mergetool "bc4"]
      cmd = bcomp \
      "$PWD/$LOCAL" \
      "$PWD/$REMOTE" \
      "$PWD/$BASE" \
      "$PWD/$MERGED"
      keepBackup = false
      trustExitCode = false
    I found that code on http://www.iokom.com/drupal/node/4.

    I'd be interested to know your findings.

    -Damien

    Comment


    • #3
      I haven't been able to get it to work either. If I set it up using the Linux instructions, then the program opens with two blank files.
      If I set it up using dwhite's instructions, then it opens up with the new version on the right and nothing on the left.

      If I figure it out I'll post it here.

      Comment


      • #4
        Turns out git (at least version 1.8.2.1) has built-in support for BC3, which also works in BC4. Running this:
        git difftool --tool bc3
        Shows all the diffs, one at a time.
        To set up a command to quickly diff in BC4, run:
        git config --global alias.bcdiff "difftool --tool bc3"
        Then you can run git bcdiff.


        To show all the diffs at once, I tried to use:
        git difftool --tool bc3 --dir-diff --no-symlinks
        But it looks like if bcomp is called on a directory, it returns immediately rather than waiting, so the files get deleted by difftool before you can look at them. I'll open a different issue for that.

        Comment


        • #5
          FWIW, the following .gitconfig options work for me after installing command line tools:

          Code:
          [diff]
              tool = bcomp
          [difftool]
              prompt = false
          [difftool "bcomp"]
              trustExitCode = true
              cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE"
          [merge]
              tool = bcomp
          [mergetool]
              prompt = false
          [mergetool "bcomp"]
              trustExitCode = true
              cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

          Comment


          • #6
            Thanks for pointing out the "Install Command Line tools" option dwhite, that helped and when I use lincolnq's .gitconfig git difftool works as expected.

            Comment


            • #7
              @lincolnq - Thanks! That configuration seems to work perfectly.

              Comment


              • #8
                Alias to easily view commit diff in BC4

                I have git set up to use difftool as well.

                Here's my alias to show the diff for a specific commit, using bc:
                Code:
                showdiff = !sh -c 'git difftool $1^..$1' -
                Example use:
                Code:
                git showdiff 5dddec1  # Like git show, but opens BC4 instead

                As a possible bonus, here are my other favorite git aliases. Try 'em and see whether you like 'em.

                Code:
                # better git log
                lg = log --graph --pretty=format:\"%Cred%h%Creset - %C(yellow)%an%Creset - %s %Cblue%d%Creset %Cgreen(%cr)%Creset\" --abbrev-commit
                
                # show message and files for a commit
                smf = show --name-status
                
                # show git aliases
                alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ = \\2/' | sort
                
                # Show me commits that I haven't pushed to the upstream yet (usually the remote branch).
                  newcommits = !git lg @{u}..
                
                # Safely update from the upstream branch (usually a remote branch).
                pr = pull --rebase 
                
                # A few more goodies
                brall = branch -avv
                st = status -s

                Comment


                • #9
                  Originally posted by lincolnq View Post
                  FWIW, the following .gitconfig options work for me after installing command line tools:

                  Code:
                  [diff]
                      tool = bcomp
                  [difftool]
                      prompt = false
                  [difftool "bcomp"]
                      trustExitCode = true
                      cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE"
                  [merge]
                      tool = bcomp
                  [mergetool]
                      prompt = false
                  [mergetool "bcomp"]
                      trustExitCode = true
                      cmd = "/usr/local/bin/bcomp" "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
                  This looks to be the currently recommended config in the sticky faq item for mac.

                  When I use this config block with git version 1.8.3.4 (Apple Git-47), 'git mergetool' works ok, but 'git difftool' dumps a stream of diff hunks and conflict markers to console instead of spawning beyond compare 4.

                  I have Version 4.0 beta (build 17677) and its command line tools installed.

                  Comment

                  Working...
                  X