2

I've made a simple regex find & replace in my project which affected ~300 files, mostly in 2-5 lines per file. In addition there were some minor tweaks and manual changes to fix irregular case.

Now I want to see all diff and compare each change using some compare tool (preferably beyond compare 4).

The best I came up with was to use git diff > changes.diff but this is still a single document and I prefer to see it side by side.

Is there a way to view all diffs in a single compare window?

P.S I could probably parse the diff file and take the + lines to one file and - lines to another, but hopefully there's something automatic for me to use.

EDIT:

I'm not looking for a way to compare diff using a tool like Beyond Compare. I want to view all changes from multiple file at once as side by side comparison. I don't want to go over the 300+ files one by one and compare using BC, instead I want to open a single file which contains all changes and compare it to the same file without the changes.

For example, if I have 2 files test1.cpp and test2.cpp and I do git diff I'll get:

diff --git.....
--- a/file1.cpp
+++ b/file1.cpp
@@ ....
- foo("a", "b");
+ bar("a", "b");

--- a/file2.cpp
+++ b/file2.cpp
@@ ....
- foo("x", "y");
+ bar("x", "y");

I want to be able to open BC and see something like (in a single tab/window):

--- a/file1.cpp     |    +++ b/file1.cpp
foo("a", "b");      |    bar("a", "b");
                    | 
--- a/file2.cpp     |    +++ b/file2.cpp
foo("x", "y");      |    bar("x", "y");
ZivS
  • 2,094
  • 2
  • 27
  • 48
  • @phd I've updated the question – ZivS Jan 19 '19 at 21:50
  • https://stackoverflow.com/search?q=%5Bgit-diff%5D+side-by-side – phd Jan 19 '19 at 23:08
  • @phd, this is the same as viewing the uncommitted changes in any gui for git, I'd still need to go over each file separately – ZivS Jan 20 '19 at 08:32
  • [Use sdiff](https://stackoverflow.com/a/49687852/7976758) as an external diff. – phd Jan 20 '19 at 10:43
  • Or [use `difftool --no-prompt` with sdiff](https://stackoverflow.com/a/39225649/7976758). – phd Jan 20 '19 at 10:44
  • Or `git difftool --no-prompt -x 'diff -y'` – phd Jan 20 '19 at 10:45
  • Just adding to Chris Kennedy answer, you could first generate a report with Only Differences in Plain Text and after that, swap the folders and generate the report again and done! You have 2 report files which you can compare to each other listing all changes in all files in folder and have the full Beyond Compare functionality. – Luis Montemayor Mar 11 '21 at 22:51

2 Answers2

2

To output all file differences to a single file using Beyond Compare:

  1. Run Beyond Compare.
  2. Open the Folder Compare and load a pair of folders.
  3. Select the files you want to compare.
  4. Actions > File Compare Report.
  5. Select Side-by-side as the report layout.
  6. Set Output options to HTML report or Plain text.

To cycle through differences one file at a time:

  1. Run Beyond Compare.
  2. Open the Folder Compare.
  3. Load a pair of folders.
  4. Double click on the first pair of files in the Folder Compare to display their contents in the Text Compare.
  5. Use Search > Next Difference (Control+N) to cycle through differences within the current file.
  6. Use Search > Next Difference File (Control+M) to cycle to the next file.
Chris Kennedy
  • 2,639
  • 12
  • 11
  • Oowww nice! This is very helpful, thank you! However, I won't tick this as the answer since this way shows the entire content of the file and not just the surrounding line around the difference, and in addition it does not allow me to use the features BC has when comparing files (such as Align, Move from side to side etc.) – ZivS Jan 22 '19 at 07:16
  • 1
    To only see different lines in the report, change the dropdown in the report dialog from **All** to **Differences**.To include a few matching lines above and below each different line, check **Show Context**. – Chris Kennedy Jan 28 '19 at 19:53
1

You can take a copy of the repo and then stash your changes in the copy. Afterwards, you can compare both the folders in any diff tool like beyond compare etc.

Mohit Gupta
  • 649
  • 1
  • 7
  • 15
  • This is the same as viewing the changes inside Visual Studio (for git repo) or any other gui tool for git, it doesn't combine all changes into a single file – ZivS Jan 20 '19 at 08:33