Is there a way to use a command like git ls-files
to show only untracked files?
The reason I'm asking is because I use the following command to process all deleted files:
git ls-files -d | xargs git rm
I'd like something similar for untracked files:
git some-command --some-options | xargs git add
I was able to find the -o
option to git ls-files
, but this isn't what I want because it also shows ignored files. I was also able to come up with the following long and ugly command:
git status --porcelain | grep '^??' | cut -c4- | xargs git add
It seems like there's got to be a better command I can use here. And if there isn't, how do I create custom git commands?