Undo a file which has already been added is quite easy using git, forGit. For resetting myfile.txt
, which have already been added, use:
git reset HEAD myfile.txt
ExplainExplanation:
After you staged unwanted file(s), to undo, you can do git reset
,. Head
is head of your file in the local and the last parameter is the name of your file.
I createhave created the steps in the image below in more details for you, including all steps which may happen in these cases: