Compare and Edit Branches in Git with a Mergetool
Asked Answered
E

1

14

I have 2 branches that I can compare/diff using my difftool (Beyond Compare). However, the files used for the diff are temporary copies and not the actual files from the current branch. This means that if I want to make a change to an existing file, I cannot do it via the difftool. I would need to make a copy of the files of one branch, checkout the other branch and use a regular diff between the actual files.

Is there a way to get the difftool to use the actual files of the current branch (at least on one side)?

UPDATE and SOLUTION:

The command I used was git difftool branch1 branch2. This diffs 2 branches regardless of the current branch.

The command git difftool branch works as desired, with one "side" as the currently checked-out branch.

Ellynellynn answered 29/7, 2010 at 14:41 Comment(3)
How are you running difftool? When I run it (using meld), I get one copy in my workspace and one in /tmp/.Deacon
I ran git difftool branch1 branch2. This was the problem! When I now ran git difftool branch1 it all worked as expected, with one "side" was the current branch.Ellynellynn
After a long sought debugging process, the above comment is spectacular and fixes my problem that is saving using git difftool <branch1> <branch2> was saving to a temporary location, not the current branch. See Adi's commentDworman
E
16

The command git difftool branch works as desired, with one "side" as the currently checked-out branch.

Ellynellynn answered 29/7, 2010 at 19:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.