开发者

Creating a new commit from history

Let's say someone has updated the remote origin with some nonsense and I want to ignore it. My repo looks like

A-B-C-D

And the remote is

A-B-C-D-E-F

I basically want to ditch E & F, but keep the history, so hopefully the result would look like

      /-----\
A-B-C-D-E开发者_如何学运维-F-G

I can't see how to reset or revert without replaying E & F on top. I can't see how to merge without keeping E & F's changes. G & D should be precisely the same basically.


So, you want to undo the changes in E and F, but retain E and F in the history? Use git revert with the -n (no commit) option:

$ git revert -n $F
$ git revert -n $E
# Fix conflicts, check to make sure the reverts look good, etc.
$ git commit
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜