这不是一个主要问题,只是我想知道是否可能。
假设我们有两个提交abcd123和wxyz789 ,这些提交发生在非相邻的单独的地方,远远落后于回购历史。 现在我们想要恢复它们。 干
git revert abcd123 wxyz789将导致两个单独的提交,一个返回abcd123 ,另一个返回wxyz789 。
这一切都很好,但是如果我们想在两个提交中修正的错误是逻辑关联的,为了自我文档的目的,我们想做一个单一的提交,包含一个单“ 我现在断了我正在还原文件x,y和z “评论? 有没有一个git命令呢?
(我当然知道可以创建一个提交,我只需手动修改所有的变化,然后再推,这对所有的这些讨厌的原因是很痛苦的。)
This is not a major problem, just something I want to know whether or not is possible.
Let's say we have two commits, abcd123 and wxyz789, that occur at non-adjacent, separate places, far back in a repo's history. Now let's say we want to revert them. Doing
git revert abcd123 wxyz789would result in two separate commits, one reverting abcd123 and the other reverting wxyz789.
This is all fine and well, but what if the mistakes we want to fix in the two commits are logically linked, and for the purposes of self-documentation we'd like to make one single commit containing one single "I broke something so now I'm reverting files x, y and z" comment? Is there a git command that does this?
(I am of course aware that it is possible to create a commit where I just manually fix all the changes and then push. This is painful for all the obbious reasons.)
最满意答案
你可以做:
git revert abcd123 git revert --no-commit wxyz789 git commit --amend...然后写一个适当的提交消息,描述恢复这两个提交的组合效果。
You can do:
git revert abcd123 git revert --no-commit wxyz789 git commit --amend... and then write an appropriate commit message describing the combined effect of reverting both commits.
更多推荐
发布评论