if we commit our code, and we want to reverse it (go back to the previous commit we use git reset command .this command is used to move (HEAD), latest commit of our working tree.
git reset command undo changes, we can reset files too. we cannot get our changes back once removed .git reset –hard is used to delete, completely .hard resets working tree and index. uncommitted changes and staged files will be lost, if we use –hard
Reset staged changes
Remove number of commits
here n indicates the number of commits to reset.from the below example 4 commits will be reset from current commit