GIT branch-to-branch comparison (ala Subversion Profile)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IDisposable
    Visitor
    • Oct 2005
    • 7

    GIT branch-to-branch comparison (ala Subversion Profile)

    I've been a BeyondCompare addict since 1.0 and have over time gone through MANY* different version control systems. These days, I find myself doing most of my work in Git (and GitHub). Since Git is so branch happy, I often find myself pulling multiple copies of a repository into distinct directories and doing a git checkout of the appropriate branch, then doing a BeyondCompare Folder Comparison.

    This is annoying in two ways... firstly the need to have TWO copies of the .git metadate/blob folder is disk-expensive, secondly the need to explicitly check out a specific branch and all the git-churn that requires.

    What I would LOVE is the ability to set a Source Profile (using similar interface to the Subversion Profile) that lets me specify the repository (usually a local directory, but no reason it can't be a remote https:-protocol git URL) and select a branch/tag/SHA. Then, especially when running against a local .git repository, we would not even need to checkout the files as Git is very good at telling us what the differences actually are... but getting my (well loved!) BeyondCompare interface on top would RULE.

    * Polytron PVCS, Team Foundations, Subversion, Mercurial, Bazaar, and now Git.
    Last edited by IDisposable; 11-Aug-2016, 11:35 AM. Reason: Change title
  • Aaron
    Team Scooter
    • Oct 2007
    • 15996

    #2
    Hello,

    Git supports a --dir-diff variable that can be used to perform folder level comparisons. I believe this still generates local files for us to view, but it would handle many of the steps automatically. Here is a reference forum post and blog post link on the setup:
    https://secure.scootersoftware.com/v...Using-with-git

    Update: And I should add, we're always on the look out for additional Profile types. It would have to be a specific "Git" profile, as seen with Subversion, most source control does not support generically connecting to it remotely.
    Aaron P Scooter Software

    Comment

    • IDisposable
      Visitor
      • Oct 2005
      • 7

      #3
      Yes, I'm hoping for a new Profile type for Git repositories, that would understand (at minimum) at local file reference (to where the .git folder is) or (better) optionally an HTTPS:// protocol https://github.com/GSA/data.gov.git, or (added bonus) optionally an SSH: protocol [email protected]:GSA/data.gov.git

      Obviously, the pie-in-the-sky hope would be to avoid having to do more than clone the meta-data down... e.g. not doing the check-out at all, but no idea how the Subversion Profile works, so not sure that's possible... I could implement this as a first-step if I had an example of how to write a Profile provider...
      Last edited by IDisposable; 11-Aug-2016, 11:43 AM.

      Comment

      • IDisposable
        Visitor
        • Oct 2005
        • 7

        #4
        I never knew about --dir-diff, that's awesome, thanks!

        Any way you can think of to pass the branch names down instead of the directories just being \left and \right

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 15996

          #5
          I don't believe so. I'm not familiar with a way for Git to pass the branchname as text on the command line:
          https://git-scm.com/docs/git-difftool

          Our command line would accept bcomp.exe "path1" "path2" /vcsleft="branchname1" and /vcsright="branchname2" to override the names presented in the folder paths.
          Aaron P Scooter Software

          Comment

          • peebles
            Enthusiast
            • May 2015
            • 33

            #6
            I've been using git difftool --dir-diff with beyond compare for a while. With the latest updates of git and beyond compare, however, I can't compare two branches anymore.

            git difftool --d <branch1>, used to compare current branch to <branch1> opens beyond compare with no files on the left side.
            git difftool --d <branch1> <branch2>, where none of the branches is the current one, seems to work.

            Current git version: 2.9.3
            Current bc version: Version 4.1.8 (build 21575)

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 15996

              #7
              Hello,

              I tested an older VM with Git 1.8.x and the newest 2.10.0.windows.1, and both function as expected. Is your current .gitconfig using "bc3" as the keyword definition, following our KB article?
              http://www.scootersoftware.com/support.php?zz=kb_vcs

              Is updating Git to test against the newest release an option? Since BC3 is opening arguments passed by Git, did you also update or alter Git in any way around the time you updated BC3? You can also use Process Explorer to check the command line used by Git to call Bcomp.exe. It would need to include 2 folders for us to be able to load the locations.
              Aaron P Scooter Software

              Comment

              • peebles
                Enthusiast
                • May 2015
                • 33

                #8
                Hi Aaron,

                I do have .gitconfig with 'bc3'. In fact, it works when I use two branches I'm not working with. I'm running on Ubuntu 16.04.
                Apparently git version 2.10.0 is not available in the repository using apt-get update, i'll wait a few days and come back to you once I update.

                Comment

                • peebles
                  Enthusiast
                  • May 2015
                  • 33

                  #9
                  Hello,
                  just updated to git 2.10.0 and still same results. git difftool -d does not show any files on the left side.

                  Comment

                  • peebles
                    Enthusiast
                    • May 2015
                    • 33

                    #10
                    Hi,

                    my Ubuntu got updated today:
                    - beyond compare was updated to 4.1.9
                    - git was updated to 2.10.1

                    After those updates, git difftool -d is working again. I've checked the release notes for git and beyond compare and haven't found anything about this issue in any of them, so I'm not sure who fixed it.

                    Edit: I've run some more tests. Apparently if I do 'git difftool -d' from the root folder, it works, if I'm in a subfolder it doesn't. 'git difftool', on the other hand, works well no matter if i'm in a subfolder or not.
                    Last edited by peebles; 06-Oct-2016, 02:25 AM.

                    Comment

                    • Aaron
                      Team Scooter
                      • Oct 2007
                      • 15996

                      #11
                      Thanks for that information. I've set up a similar environment, but I am seeing slightly different behavior. git difftool -d always launches at the top of the repository, even if I execute the command line within a subfolder and only that subfolder contains differences. So, I see a Folder Compare view with only the subfolder (which still needs to be expanded) and the different file within. git difftool -d branchname similarly diffs the entire current branch to named branch. In what location are you browsing on the command line and what is the exact command line you are executing?
                      Aaron P Scooter Software

                      Comment

                      • peebles
                        Enthusiast
                        • May 2015
                        • 33

                        #12
                        Hi Aaron,

                        let's say my git repository is at folder 'foo', and there is a subfolder 'foo/mak'
                        My command is 'git difftool -d'.
                        If I execute it in 'foo' folder, everything works fine. If I execute it in 'foo/mak' subfolder, my beyond compare launches at the top of the repository, but only the right side shows subfolders with differences that can be expanded. The left side is empty.

                        Comment

                        • Aaron
                          Team Scooter
                          • Oct 2007
                          • 15996

                          #13
                          Hello,

                          If you run git --version does it report at 2.10.1? The Git website has this version if you build from code, but Ubuntu's apt-get install's latest seems to be 2.7.4. My tests have so far been with 2.7.4; I'm working on making from source, but I'm running into missing dependencies since my VM is mostly a fresh install otherwise.
                          Aaron P Scooter Software

                          Comment

                          • peebles
                            Enthusiast
                            • May 2015
                            • 33

                            #14
                            Hi,
                            yes, i'm using git version 2.10.1. Mi Ubuntu upgraded to this version last week.

                            Comment

                            • Aaron
                              Team Scooter
                              • Oct 2007
                              • 15996

                              #15
                              Hello,

                              I've built from source from git-scm.com. git --version returns
                              "git version 2.10.0.GIT"

                              git difftool -d always launches at the top level, even if the command line is in a subfolder/, so I always start at the top and both sides fully populate.

                              What does your .gitconfig look like? I'd like to verify we have similar setups. If you make any changes to git or the .gitconfig, please reboot to make sure nothing is cached and using old settings or versions. For example, after building, I had to reboot to properly update Git to 2.10.0
                              Aaron P Scooter Software

                              Comment

                              Working...