The other day, I had some merge conflicts to resolve on a project with another team member. Prior to this, I had been developing on the working branch and had created new files. Being lazy, I never added those untracked files in my commit previously, so I jumped right in and did a pull.
Because of the resulting merge conflicts, git loves to leave around .orig files on my system. If you are a neat freak like I am, I hate having extraneous useless files in my file system. Remember, I still had untracked files in my working directory that git had no idea about yet. I decided to continue on and remove the .orig files so git would stop showing them to me.
git clean -f
Unbeknownst to me, doing this wiped out all my new files that I had created. Panicking, as there were quite a few new files, I tried to figure out how to get these back. Doing a reset of the head to a certain hash didn’t help one bit. Looking into the reflog had no luck either. Luckily, my previous commit before the pull had some trace of these new files and I decided to popup gitX — an awesome GUI for git those that can’t stand terminal output, me included.
Quickly going back through my history, I found the files. Not completely sure how they were still there, but I found them and was able to get them back to a working point.
Now I know that using git clean will also wipe out your untracked-unstashed files.