Tapatalk

How do I git diff a different branch in UC?

How do I git diff a different branch in UC?

5
NewbieNewbie
5

Post14:09 - Feb 13#1

How do I git diff a different branch in UltraCompare?

I can only diff files, there must be a way to diff branches.

Thank you.

35
Basic UserBasic User
35

Post22:50 - Feb 13#2

I was also curious, so I asked an AI, I haven't tried this yet:

To perform a git diff of a different branch using UltraCompare, you have two main approaches: using the command line (which "pipes" the difference into UltraCompare) or using the UltraCompare GUI if you have your repository opened.

Method 1: The Command Line (Recommended)
If you have UltraCompare integrated as your difftool, you can compare your current branch against another branch (e.g., main) with a single command.
  1. Open your terminal/command prompt.
  2. Run the following command:
    Bash

    git difftool <branch_name>

    Replace <branch_name> with the branch you want to compare against.
  3. Result: Git will launch UltraCompare for each file that differs between your current branch and the target branch.
Note: If you want to compare two specific branches (neither of which is your current branch), use:
git difftool branch1..branch2
Method 2: Comparing Specific Folders in the GUI
If you prefer not to use the terminal, you can do this manually by pointing UltraCompare to the different directory states:
  1. Open UltraCompare.
  2. Go to Folder Mode: Select 3-Way Folder Compare or 2-Way Folder Compare.
  3. Path 1: Browse to your active project folder.
  4. Path 2: Browse to a local clone or a specific git checkout of the other branch.
  5. Hit Go: UltraCompare will highlight every file that is different. Double-clicking a file will open the File Compare view to show the code changes.
Method 3: Setting UltraCompare as your Default Difftool
If Method 1 didn't work, it's likely because UltraCompare isn't configured in your .gitconfig yet. You can set it up by running these commands:
Bash

git config --global diff.tool uc
git config --global difftool.uc.cmd 'uc.exe "$LOCAL" "$REMOTE"'

(On macOS/Linux, replace uc.exe with the path to the uc executable).
Pro Tip: Comparing with a Remote Branch
If you want to see what is different between your local branch and the version on GitHub/GitLab without merging yet, use:
Bash

git fetch origin
git difftool origin/<branch_name>

See if this is what you were looking for.

HTH,
Billy

5
NewbieNewbie
5

Post14:45 - Feb 17#3

I have been using method 2 for years. Simple

Method 2: I just set up my .gitconfig do a branch compare.  I always could do 1 file compare and never figure full branch diff.  I finally figured this out till this week.  I do not like it opens each file in a new window unless I choose 1 UC window in the settings.  I would like to have diff projects in diff windows, but I can deal with that.

For a few weeks I will try git difftool --tool=uc  so I can have meld and uc working.

thanks