The reset command resets the staging area to be whatever is in HEAD. This clears the staging area of the change we just staged.
The reset command (by default) doesn’t change the working directory. So the working directory still has the unwanted comment in it. We can use the checkout command of the previous lab to remove the unwanted change from the working directory.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cited from Removing Commits from a Branch
When given a commit reference (i.e. a hash, branch or tag name), the reset command will …
- Rewrite the current branch to point to the specified commit
- Optionally reset the staging area to match the specified commit
- Optionally reset the working directory to match the specified commit
git reset --hard v1
The --hard parameter indicates that the working directory should be updated to be consistent with the new branch head.
No comments:
Post a Comment