Reputation: 112
I have two (big) files and what I need is to extract changed/added lines only. Is a plain text file (CSV).
Simply return and save a third file with these lines..
UPDATE
I resolved with DiffMerge using the "Show Differences Only" function built in described here.
By the way, I still require a solution that "programmatically" do the same thing but I will create another Question maybe because I need it in a Linux environment.
UPDATE 2
Resolved also with TortoiseGit, see below.
Upvotes: 2
Views: 2740
Reputation: 3111
UPDATE
For viewing diff only, using "Collapse".
UPDATE 2
If you don't need the context, just set the "Context lines for patches" to zero.
Upvotes: 3
Reputation: 616
What you are looking for could be as simple as the default unified diff format given by git diff
but with context lines stripped. You will still get the location information before every change.
git diff --unified=0 <commit1>:<path/to/file1> <commit2>:<path/to/file2> > <output file>
The files do not have to be versioned under Git, you can just omit the commit reference in that case (or when comparing separate files in same version). For different versions of the same file
git diff --unified=0 <commit1> <commit2> -- <file> > <output file>
Upvotes: 0
Reputation: 2725
diff --changed-group-format='%<' --unchanged-group-format='' file1 file2
Upvotes: 0