开发者

How to git diff from an earlier version without some of the intermediate additions?

I'm working on an addition to a project that is loosely based on another patch to the same project. I started by cloning the repository (A). I then applied the patch I wanted use as "inspiration" for my additions (B). I made a branch in preparation for my changes (开发者_运维技巧C) and then added the new code (D).

A-----B
       \
        \
         C-----D

I want my new additions to be separate from the "inspiration" patch. How can I now generate a patch file (ie, git diff) that does not include the "inspiration" patch (B or C)? The patches will each essentially represent a plugin with a unique use case, so the process for getting each rolled into the project will be different.


You need to rebase your change to be based on A instead of C.

git rebase --onto A C


If D doesn't depend on B or C, you should just be able to generate a patch from C->D and get exactly what you want:

git format-patch C..D
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜