如何在分支B和工作目录A中创建所有更改(例如10天)的修补程序?

时间:2016-11-03 10:28:21

标签: git git-patch

我尝试使用命令

git diff branch1 branch2 -- folder/ > mypatch.patch

但是当我使用

git am --signoff mypatch.patch

我收到错误

Patch format detection failed.

1 个答案:

答案 0 :(得分:0)

当前分支的变化:

git log -p --since=10.days > mypatch.patch

当前分支的变化,但不在branch2

git log HEAD --not branch2 -p --since=10.days > mypatch.patch

branch1中的更改,但不在branch2中的更改:

git log branch1 --not branch2 -p --since=10.days > mypatch.patch

您也可以使用--before以类似方式指定上限日期范围:

git log -p --since=10.days --before=2.days > mypatch.patch

Documentation for git-log,“提交限制”和“常见差异选项”部分。