Git reset command

We can use git reset command to remove the commits from the branch.

git reset <option> <commit-hash>

The git reset has three optionss:
a) --soft: reset only HEAD

git reset --soft <commit-hash>

b) --mixed (default behavior): reset HEAD and index
git reset <commit-hash>
git reset --mixed <commit-hash>

The above command will remove the commits in front of specified hash.

The changes in the files are not reset to that commit, only the commit history is wipe out upto that commit.

c) --hard: reset HEAD, index and working tree
If we want to undo both the commits AND the actual changes in our files, we can use the --hard option.
For example, git reset --hard HEAD~1 will delete the last commit and associated changes. Be cautious when using this option as it permanently discards uncommitted changes.

git reset –hard <commit-hash>