问题
I'm trying to mash all my changes since I last pushed to the svn server into one big patch that I can email to my coworker for review. Can I do this with git format-patch
?
回答1:
You could use git format-patch origin/master
to get all the patches since your current branch forked from the server. (The HEAD is assumed as the final argument in the command, so you are getting origin/master..HEAD
.)
However, as VonC hints at, that could potentially create a lot of files: one .patch file for every commit you made! If you want just a single big patch file, the git-diff
syntax he mentions should to the trick. (git diff origin/master.. > bigpatch.patch
would give you all the changes since the common ancestor of your HEAD and the server.)
回答2:
For dealing with one file, git diff is more appropriate (for patches of text files)
git diff R1..R2 > patchR1R2.diff
来源:https://stackoverflow.com/questions/2917727/git-format-patch-everything-since-last-svn-rebase