问题
I have 2 files (one modified and a new file) as modified for a commit. I want to create a patch for this. I created a patch using TortoiseGit and I can see that patch contains changes for both the files.
However, when I apply this patch into some repository, it applies both the changes but the new file is not shown as added. Due to this, if I simply say: git commit, the newly added file is missed out of commit.
Is this a bug of TortoiseGit or I am doing something wrong?
I tried to create a patch using 'git --diff' but in such a case, it does not include the added file as part of the patch at all.
Thanks, Vibhav Agrawal
回答1:
Using TortoiseGit, you should create the patch by committing your changes (the modification and the addition), right clicking the repo and choosing Create serial patch...
and choose Number of Commits
as 1
.
Then in the other repository you right click the repo and choose Apply serial patch...
use Add
to add the patch file created earlier. Then click Apply
.
This should create a new commit in the other repository containing both the modification and the new file.
来源:https://stackoverflow.com/questions/16025109/tortoisegit-apply-patch-skips-added-files