Rebase vs reset vs revert? I just wanna back off

Let's say I make a series of commits, call them 1, 2, 3, 4, 5, and 6 (hashes).

Let's say I'm on a commit with a hash 6. All I want to do is go back to hash 3, make the state of my codebase the same as when I committed hash-3, as if another commit never It was.

When I look at answers like it seems like everyone has a different answer. reset, revert, rebase? I'm not even sure I know the difference between these three words in English.

I just want to be in the previous commit. Can someone tell me how to do this?

+6
source share
2 answers

- - , git revert $COMMIT...

, , $COMMIT...

, :

git revert HEAD~2..HEAD

, git reset $COMMIT.

$COMMIT .

git reset --soft $COMMIT : git reset --soft $COMMIT git reset --hard $COMMIT.

, :

git reset HEAD~3

git rebase , .

, "" , , ( ), , "rebase".

+10

:

  • 3.

  • PR ( 6)

-1

Source: https://habr.com/ru/post/1653225/


All Articles