Need Assistance?

support@tutorialshub.in

Undoing Changes and Rewriting History

Reset and its three modes

ADVERTISEMENT
Git Free Lesson
5 min read
ADVERTISEMENT

Reset moves a branch reference

git reset changes what the current branch points to and can also change the staging area or working tree depending on the mode.

Soft, mixed and hard

--soft moves the branch while keeping changes staged. The default mixed mode resets the index but keeps working-tree changes. --hard resets both the index and working tree, which can permanently discard uncommitted work.

Use reset mainly for local history

Reset is especially useful for cleaning up commits that have not been shared. Avoid rewriting a shared branch unless your team explicitly uses a coordinated history-rewrite workflow.

ADVERTISEMENT