Git cancel a revert

前端 未结 3 783
半阙折子戏
半阙折子戏 2020-12-29 19:32

In git let say I commit A and B

A---[B]

But then I revert with

git revert HEAD

So I am there now:

3条回答
  •  青春惊慌失措
    2020-12-29 20:14

    As you create a new commit which reverts another commit you can treat it like a normal commit.

    So basically you have many choices, such as

    • git rebase -i (remove the revert commit)
    • git reset --hard (reset to the commit before the revert, you'll lose all local changes)
    • git reset --soft (same as above but keeps local changes)
    • technically you can use git revert to revert your revert

提交回复
热议问题