I have FileA in branchA and FileB in branchB.
The problem is that I can access only one file at time. I would like to be able to compare the files by FileMerge or meld, since they are the only diffTools whichI have found for Mac.
How can you diff by meld/FileMerge the two files?
[Solved]: 1st developed Problem: FileMerge does not allow standard input
Masi: You can use opendiff to allow FileMerge to have files from standard input. So the next problem is to find how to make git's diff tool to use opendiff.
2nd developed Problem: to make Git's diff tool to use opendiff in Mac
In answer to the original question, git diff isn't showing anything because you have a brand new directory, with a newly added file, but there are zero changes in the file for git diff to show. git status is showing that you added a new file, but git diff is for showing changes within files.
The git diff command displays the differences between files in two commits or between a commit and your current repository. You can see what text has been added to, removed from, and changed in a file. By default, the git diff command displays any uncommitted changes to your repository.
You can use "git mergetool" for merging, and in modern git (meaning version 1.6.3 and later) "git difftool" for comparing using graphical tools. Of course you would have to configure them first, but they do some autodetection (with some hardcoded preference, of course), and if I remember correctly opendiff support is built in.
And then of course you would be able to use your graphical tool (opendiff / FileMerge) as you would use ordinary "git diff", for example
prompt> git difftool somebranch:UNREADME otherbranch:README
git supports branch names as part of the repository paths. Eg if you have the following files in your repository, README
only on master
, and UNREADME
only on branch
:
master:README branch:UNREADME
You can diff them via git with:
git diff branch:UNREADME master:README
You can get a repository artifact to standard output with git show
:
git show branch1:UNREADME
So if your external diff utility can take 2 files on the bash prompt, you can diff them with something like:
diff-command <(git show branch1:UNREADME) <(git show master:README)
Where the <(...)
bash syntax takes the output of the enclosed command, runs it in a pipe and places the file path of the pipe on the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With