- git reset
It modifies the index (the so-called "staging area"). Or it changes which commit a branch head is currently pointing at. A reset is an operation that takes a specified commit and resets the "three trees" to match the state of the repository at that specified commit.
Git reset should generally be considered a 'local' undo method because it adds complications when working with a shared remote repository. If we have a shared remote repository that has a commit pushed to it, and we try to git push a branch where we have reset the history, Git will catch this and throw an error. Git will assume that the branch being pushed is not up to date because of its missing commits. In these scenarios, git revert should be the preferred undo method.
A reset can be invoked in three different modes which correspond to the three trees:
• --soft
– The staged snapshot and working directory are not altered in any way.
• --mixed
– The staged snapshot is updated to match the specified commit, but the workin