I
I
ivandao2021-05-21 10:58:59
git
ivandao, 2021-05-21 10:58:59

What is the difference between undo commit, revert commit and reset branch to commit?

What's the Difference?
60a768386e748939816495.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2021-05-23
@ivandao

There are a few more methods to rollback changes in the menu of your IDE.
Is that JetBrains? All methods are described in detail in the help, for example, here's how in IntelliJ IDEA
Reset removes all commits above the selected one. There are four options for this command. They differ in how to deal with changes in the working directory and in the index.
Revert does not delete a commit, but creates a new one that describes the actions required to undo the selected commit.
Undo allows you to undo the last commit. But the commit changes suggest saving to a new changelist . The files in the working directory will not change and you can tweak and re-commit them.
Dropis a handy command for deleting an arbitrary commit from the middle of history. Under the hood, it actually does an interactive rebase , but in automatic mode.
Revert Selected Changes is similar to Revert , but reverts changes to a single file rather than the entire commit. This command is available in the Changed files panel .
Get allows you to return any file to the state at a specific commit in history. Select a file in any convenient way and context menu Git | Show History will show all the commits in which the given file has changed. By clicking on the desired commit with the right button, we will see the Get command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question