Either i'm going nuts or nobody likes/liked this feature, but a long time ago i used to use subversion with sourceforge system. I had the ability to create full file patches for commits done.
I cannot figure out anyway to create these in git, all i want is the files that were changed from XX commit and only those files in their entirety so that i could hand them off to someone/upload just those files to a location.
As it currently stands i'm stuck reuploading the entire project because i have nothing that tells me what was changed. Since we're also on a shared web host there is no way to get git on the server without upgrading to more expensive package.
I've tried
git archive --output=/home/username/temp.zip <commit id>
which put everything into a zip nicely but it did just that, it put everything. Also tried a variation of format-patch but that didn't seem to work.
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.
You can squash those commits into one commit using git rebase . After you have that one commit, you can use git format-patch to create the patch file of it.
The first thing to try would be to save the output of git diff
, which might be sufficient in your situation:
git diff oldcommit > test.patch
If you have changed binary files since then, you could try:
git diff --binary oldcommit > test-with-binaries.patch
In that case you'd then need to apply the patch with git apply
. Otherwise, I would create a new branch based on oldcommit
, do a squashed merge from master
, commit the result and and use git format-patch
to produce the patch. That method (and several other solutions to your problem) are described in more detail in the answers to this similar stackoverflow question: How do you squash commits into one patch with git format-patch?
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