Thursday, March 29, 2012

git remove untracked files

I do a lot of branch switching and files which are ignored in one branch show up as untracked files. This gets annoying during merge conflicts as then its difficult to keep track of whats actually conflicted and new and whats not.

After trying around a few commands this alias works great for me

vi ~/.gitconfig

remove-untracked = "!git ls-files --other --exclude-standard | xargs rm;"

Now just run git remove-untracked and the eyesore is gone!

No comments: