Announcement

Collapse
No announcement yet.

git difftool load all files into a folder compare view

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

  • git difftool load all files into a folder compare view

    Hey,

    I've recently migrated from TortoiseHg/BeyondCompare to GIT/BeyondCompare. When I was comparing commit revisions in Hg, it would load all of the differences into the folder compare view - from there I could double click any file to see its differences.

    I have successfully setup git to use BC3 as both difftool and mergetool. However, when I run 'git difftool' it loads each of the files sequentially as textcompare in bc3 and waits for me to close each file before loading the next one.

    I have found a solution which enables loading of all the files simultaneously, however, they are still loaded as tabbed text compares with no folder compare tree for me to look at. http://blog.codefarm.co.nz/2009/08/g...all-files.html

    Does anyone know how I can load my diffs into a folder view?
    Thanks,
    -- Adam.

  • #2
    Hi Adam,

    similar to my question from Januar:
    http://www.scootersoftware.com/vbull...ead.php?t=7211

    I have found a solution which enables loading of all the files simultaneously
    Thanks for the hint, it may be usefull for me.

    Comment


    • #3
      I'm not aware of a method for git to compare revisions as Folders. If there are any users who know of a method, please let us know.

      One thing that may be useful is to perform an export of a revision to make a local copy of the repository you want to compare your local files to.
      http://stackoverflow.com/questions/1...ike-svn-export
      Aaron P Scooter Software

      Comment


      • #4
        Originally posted by thegoatherder View Post
        Hey,

        I've recently migrated from TortoiseHg/BeyondCompare to GIT/BeyondCompare. When I was comparing commit revisions in Hg, it would load all of the differences into the folder compare view - from there I could double click any file to see its differences.

        I have successfully setup git to use BC3 as both difftool and mergetool. However, when I run 'git difftool' it loads each of the files sequentially as textcompare in bc3 and waits for me to close each file before loading the next one.

        I have found a solution which enables loading of all the files simultaneously, however, they are still loaded as tabbed text compares with no folder compare tree for me to look at. http://blog.codefarm.co.nz/2009/08/g...all-files.html

        Does anyone know how I can load my diffs into a folder view?
        Thanks,
        -- Adam.
        Hello

        I know it's been 6 years since this post, but I really need exactly this and the link is broken. How did you solve this?

        Thanks!

        Comment


        • #5
          Hello,

          The key you are looking for is Git's -dir-diff support:
          https://git-scm.com/docs/git-difftool

          Define the difftool as BC, and then add an alias to use --dir-diff --no-symlinks (or just --dir-diff and after launching using the Session Setting: Follow Symbolic Links)
          https://stackoverflow.com/questions/...with-sym-links
          Aaron P Scooter Software

          Comment


          • #6
            Originally posted by Aaron View Post
            Hello,
            Define the difftool as BC, and then add an alias to use --dir-diff --no-symlinks (or just --dir-diff and after launching using the Session Setting: Follow Symbolic Links)
            https://stackoverflow.com/questions/...with-sym-links
            Thanks! that helped!

            I just have another question. I noticed that when BC opens, the changes on the working copy are in the "Right" side. Also, the path to the working copy file that appears in the BC "path" field is not the exact path for such file and therefore if I modify something it is not reflected in the actual file.

            Do you know how can I:
            1. Open BC with my working copy file in the "Left" side?
            2. point to the real working copy file path so I'm able to make changes right in BC?


            Thanks!

            Comment


            • #7
              BC4's command line expects parameters:
              bcompare.exe "c:\left" "c:\right"

              How have you currently defined your .gitconfig?
              http://www.scootersoftware.com/suppo...vcs#gitwindows

              Git does manage the directories and order automatically, but you could override this by providing more parameter detail.

              As for edits not coming through: if you remove --no-symlinks and instead enable the BC3 option in the Folder Compare's Session menu -> Session Settings -> Handling tab: Follow Symbolic Links, does this show the comparison correctly and allow the editing you need?
              Aaron P Scooter Software

              Comment


              • #8
                Originally posted by Aaron View Post
                As for edits not coming through: if you remove --no-symlinks and instead enable the BC3 option in the Folder Compare's Session menu -> Session Settings -> Handling tab: Follow Symbolic Links, does this show the comparison correctly and allow the editing you need?
                Thanks

                The symlinks suggestion worked perfectly. Now if I modify something in BC it gets reflected in the code. So that's solved.

                The thing I haven't been able to figure out is the order. You say that:
                Originally posted by Aaron View Post
                BC4's command line expects parameters:
                bcompare.exe "c:\left" "c:\right"

                How have you currently defined your .gitconfig?
                http://www.scootersoftware.com/suppo...vcs#gitwindows

                Git does manage the directories and order automatically, but you could override this by providing more parameter detail.
                This is my .gitconfigure contents

                [diff]
                tool = bc3
                [difftool "bc3"]
                trustExitCode = true
                [merge]
                tool = bc3
                [mergetool "bc3"]
                trustExitcode = true
                [alias]
                dif= difftool --dir-diff

                So my question is, what parameters should I specify to override the git directories order and more importantly, how do I specify those parameters?

                Bcause I don't see how I can specify them in the .gitconfig.

                Thanks again! You are being really helpful!

                Comment


                • #9
                  Hello,

                  Git has built-in support for using "bc" or "bc3" keywords, which then handles the parameters and everything else automatically. It's the method we recommend using. After load, you can always use the Swap button in the toolbar to flip the view of Left <-> Right

                  However, if you further define "cmd" you can pass in the path to the program and parameter list, making a more manual definition of what should be used. GitHub's definition is like this:
                  http://www.scootersoftware.com/suppo...#githubwindows

                  From Beyond Compare's perspective, our command line is bcompare.exe "left" "right" "base" "merged", so you would need to flip the appropriate variables to fit the view you need. If you are overriding /titles, please be careful to properly match the correct title to the correct variable, or the title might mismatch the data below it.
                  Aaron P Scooter Software

                  Comment


                  • #10
                    Aaron

                    Thanks for helping. Finally, I have the results I need!

                    For reference and in case somebody else lands in this thread and is looking for this solution, I will add my results here.

                    This is for opening BC to compare differences between your working copy and the last commit.

                    BC will open the working copy files on the left and the right files will be read only, thus not allowing any changes on the right-side files. Additionally, any changes made in BC editor will be made in the actual working copy files, thus allowing you to "revert" any changes individually by clicking the "Copy to Left" yellow arrow.

                    ----------------------------------------------------------------------------------------
                    [diff]
                    tool = bc3
                    [difftool "bc3"]
                    cmd = bcompare -rro "$REMOTE" "$LOCAL"
                    trustExitCode = true
                    [alias]
                    dif= difftool --dir-diff
                    ----------------------------------------------------------------------------------------

                    With that contents in the .gitconfig file, then you just execute

                    $ git dif

                    And BC will open as described above.
                    Last edited by m4l490n; 17-Jul-2017, 06:04 PM. Reason: Added more information about the solution

                    Comment


                    • #11
                      Hello,

                      That looks about what I expect except, although it is a little odd naming that $REMOTE = Working/Mine and $LOCAL = Last Commit. I see similar results testing your .gitconfig (down to Git naming the path "left" on the right side).
                      Aaron P Scooter Software

                      Comment


                      • #12
                        Originally posted by Aaron View Post
                        Hello,

                        That looks about what I expect except, although it is a little odd naming that $REMOTE = Working/Mine and $LOCAL = Last Commit (down to Git naming the path "left" on the right side).
                        It's just that I'm used to see my working copy files at the left side and the last commit on the right.

                        Comment

                        Working...
                        X