How can i completely undo git commit just done
I did commit on my branch.
I accidently added .tar.gz files in it which i want to ignore.
Then i did this
git reset --soft HEAD^
Now my commit is gone
- Modified files are as it is
- But the untracked files are now being shown as new file
How can i go back to state where the new files come as untrcaked file
A git reset --soft only moves HEAD, but don't reset the index.
A git reset @^ would moves HEAD and reset the index, making those files untracked again.
More on those reset options at "Can you explain what “git reset” does in plain english?".
See also a good illustration in "Difference between git reset soft, mixed and hard": what you want is to reset HEAD and index, not the working tree.
I have already executed git reset --soft, can I do git reset @^ or it will go back one more commit?
Then you can do a reset for the files only (not HEAD, which already references the right commit)
cd /path/to/folder/containing/tar.gz_files git reset -- *.tar.gz
Note the double-dash (--) between the git command and the files.