In order to include some untracked files in my commit I followed this post and accidently added a lot of unwanted stuff. Now I have this situation in my repo.
2016-02-02 16:51 Unknown o Staged changes <--- untracked files
2016-02-02 16:51 Unknown o Unstaged changes <-- want to preserve
2016-01-04 17:01 XXXXX YYYYY I [wool_task_conversion] [master] [origin/HEAD] [origin/master] First commit
I now want to bring back the untracked files in thier original position i.e. the unstaged area as before preserving the changes in unstaged area for tracked files.
If you look at the output of git status
it actually answers this question:
Davids-Mac-Pro:DAD dhoelzer$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: t
So, simply executing git reset HEAD <file>
will do what you are asking.
If you want to remove all staged changes while retaining the changes, the following should be correct:
git reset HEAD -- .
This should be run from the root of your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With