When I use git diff --relative HEAD^..HEAD
, I get some nice output for a patch that I strip out the path outside the directory it is in.
I am starting to use git format-patch
and I would like to also use --relative
but don't see any options for that. How would I get the same effect?
Thanks
In order to create Git patch file for a specific commit, use the “git format-patch” command with the “-1” option and the commit SHA. In order to get the commit SHA, you have to use the “git log” command and look for the corresponding commit SHA.
Patch is a text file, whose contents are similar to Git diff, but along with code, it also has metadata about commits; e.g., commit ID, date, commit message, etc. We can create a patch from commits and other people can apply them to their repository. Jerry implements the strcat function for his project.
git help format-patch
shows
git format-patch [-k] [(-o|--output-directory) <dir> | --stdout] ... **[<common diff options>]**
So, just git format-patch --relative
.
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