Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
也就是说,假设我想要一个将我从branch1到的补丁branch2,但我只关心文件foo1.c和foo2.c,而其他文件也在两个分支之间发生了变化。
branch1
branch2
foo1.c
foo2.c
如何制作包含这两个文件的补丁?
如果我这样做git diff branch1 branch2 > Change.patch,我会得到所有的文件。
git diff branch1 branch2 > Change.patch
如果我只是这样做git diff branch1:foo1.c branch2:foo1.c > Change.patch,我只会得到一个文件的补丁。
git diff branch1:foo1.c branch2:foo1.c > Change.patch
这些方面的东西应该起作用:
git diff branch1 branch2 -- foo1.c foo2.c > change.patch