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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…