Could somebody explain me the difference between a .diff file and .patch file.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What matters is the content of the file, not the extension. Both of those extensions imply that some sort of diff utility (
diff,git diff,git format-patch,svn diff) produced the output.Many diff utilities produce output which can be applied by the
patchcommand. You will frequently need to use the-dand-poptions topatchin order to get the paths matched up right (strip prefix, name target directory). If you see one of those extensions on a file distributed online, it’s almost certainly an indication it’s compatible withpatch.Git’s diff output is compatible with patch, but I believe svn’s is not. Of course, plain patches generated by
git diffare probably best applied bygit apply, and patches generated bygit format-patchare designed for use withgit-am.