Removes all files from staging area (
git reset
defaults to
HEAD
)
git reset / git reset HEAD / git reset HEAD .
Removes the specified file from staging
git reset HEAD 1.txt
Deletes all commits after the specified commit but does not change source code (keeps files staged)
git reset --soft i4ol54f
Deletes all commits after the specified commit but does not change source code (keeps files unstaged)
git reset i4ol54f / git reset --mixed i4ol54f
Deletes all commits after the specified commit and moves HEAD to that commit (this will get rid of changes so we should be careful)
git reset --hard 004caa3
Deletes the last 3 commits
git reset --hard HEAD~3
git reset
defaults to
--mixed