git高级用法-导出某次Commit过的文件和如何生成补丁包?如何打补丁?

分类:Git |

问题:现在可以导出某次Commit过的文件,请问如何能导出从这个Commit以后所有修改过的文件列表(导出成ZIP包)?

解决方法: 可以把代码增量修改的部分打包.
git archive -o update.zip HEAD $(git diff --name-only HEAD^)


问题:如何生成补丁包?如何打补丁?

1. 生成patch补丁包

git format-patch -s 1bbe3c8c197a35f79bfddaba099270a2e54ea9c7

please replace the hash code with your repo previous commit.

then you can find the patch under repo directory.

then mail your patch to configuration admin. 

或者使用

git format-patch HEAD^ <==最近的1次commit的patch

git format-patch HEAD^^ <==最近的2次commit的patch

git format-patch HEAD^ <==最近的3次commit的patch

git format-patch HEAD^ <==最近的4次commit的patch

git format-patch HEAD^^^^^ <==不支持!!!!error!!!

 

2.将补丁打上去。

patch -p1 < 0001-Added-liuxingde-test.patch

注: 0001-Added-liuxingde-test.patch为想要打的补丁的名字。运行该命令需在git项目的要目录下。



Git
阅读( 8896 ) |