Index area index
temporary storage area stage
workspace workspace (local)
git add
Add the modification to
git commit
the stage and submit the stage as a commit, and this stage is consistent with this commit
Undo changes:
1. only local modification (no add operation) git checkout ./
to
the 2.local modify, add to the stage, and without further modification (not just continue to add modifications)
. 1) git reset HEAD --mix
(the HEAD --mix can be omitted), withdrawal stage (Checkout is useless at this time, because stage and local are the same)
2) git checkout ./
Undo local modification (checkout function is to overwrite local with stage, at this time local and commit are already consistent)
3.After local modification, add to the stage and make further modifications
1) git checkout ./
Undo local changes (both further modifications)
2) git reset HEAD --mix
(HEAD --mix can be omitted), undo the stage modification (checkout is useless at this time, because (stage and local are the same)
3) git checkout ./
Undo local modification (checkout function is to overwrite local with stage, at this time local and commit are already consistent)
These three steps can be combined into onegit reset HEAD --hard
Reference:
Git-Temporary Area and Undoing Modifications