I inherited a project originally stored in CVS with all the revisions. I made quite a few edits, and I\'m trying to compare all the changes I made in the original directory,
To simply create a diff patch in git's diff format from two arbitrary files or directories, without any fancy repository stuff or version control:
git diff --no-index some/path other/path > some_filename
Jakub Narębski's comment on knittl's answer hinted at the answer... For simplicity's sake, that's the full command.
The >
part creates a file and redirects the output to it. If you don't want a file and just want the output printed in your console so you can copy it, just remove the > some_filename
part.
For convenient copying and pasting, if you've already cd
ed to a directory containing the original directory/file named a
and the modified directory b
, it'll be:
git diff --no-index a b > patch
Is there some sort of utility for hg/git where I can do a tree diff... [s]o that say, there's a mark between newly added files, deleted files... [emphasis added]
Yes. We can git diff
the current directory against another directory and...
...mark the added, deleted, and modified files:
git diff --name-status --no-index ./ path/to/other/dir
...show only added files:
git diff --diff-filter=A --name-status --no-index ./ path/to/other/dir
... show only deleted files:
git diff --diff-filter=D --name-status --no-index ./ path/to/other/dir
...show only modified files:
git diff --diff-filter=M --name-status --no-index ./ path/to/other/dir
See also: https://git-scm.com/docs/git-diff