Git Reset

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
git reset HEAD
Reset files
git reset HEAD <file1> <file2 ...n>
Remove number of commits
git reset HEAD~n
here n indicates the number of commits to reset.from the below example 4 commits will be reset from current commit
git reset HEAD~4