I have always used diff -b to make patches even when working on a git repo.
git diff / git format-patch also internally makes use of the linux/unix diff command? (I know the difference between git diff/git format-patch)patch -p1 different from git apply. Can i apply a patch generated by the diff command (diff -b) and apply using git diff ?git diff/apply when working with git? I have been using diff/patch and never faced any problem.Please correct me if my knowledge of things mentioned above is not adequate.
In order:
Git has its own built-in diff but the outputs of both are quite similar, given the right options. Using the built-in diff and the git diff front-end gets you a whole lot of automation, plus the output is always something git apply or git am will like. In short, it's just a lot more convenient.
I've done this sort of thing (fed git diff output to patch, or plain diff output to git apply). It works, although occasionally I have had to edit things here and there to get it to work, which is a pain. It's much more convenient to just get a git diff if I want to git apply or git am a patch. The biggest observable difference in general is that git apply does not do partial apply by default: you must add --reject to make it act like patch's default. (Also, all those .orig files...)
Yes, because of said convenience. When you go a bit further and use git format-patch and git am, you can mass-apply a whole series of patches, maintaining commit messages including authorship information and so on, and getting everything committed automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With