Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
701 views
in Technique[技术] by (71.8m points)

diff - git difftool to give directory compare?

Is it possible to get the git difftool command to open a directory compare between the changed files and the staging/checked files?

So ideally, if 2 files have changed, they would be the only 2 shown, but within a directory compare.

I've read posts about getting git to give all file diffs in parallel, so tools like BeyondCompare has all the diffs in tabs, but im not happy with that!

One could pull a copy of the changed files from staging/checked in files into a temp folder, and then open that up. Is that the only option?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Update June 2012 (2 and an half years later):

This (comparing directories instead of file-by-file) seems to be soon available:
See [ANNOUNCE] Git 1.7.11.rc1:

"git difftool" learned the "--dir-diff" option to spawn external diff tools that can compare two directory hierarchies at a time after populating two temporary directories, instead of running an instance of the external tool once per a file pair.

See "Patch difftool: teach difftool to handle directory diffs"


Original answer (January 2010)

One could pull a copy of the changed files from staging/checked in files into a temp folder, and then open that up. Is that the only option?

Basically yes:

You difftool script would:

  • create 2 temp directories
  • defines itself as a diff tool
  • call git diff
    • which then call itself for file to diff
    • in that mode, the same script, for each files, only copy the two version to diff in the two temp directories
  • then go on and call diff tools (like beyondCompare or WinMerge) on the two temp directories

You have one first example in this question.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...