Adding Only Untracked Files
git ls-files -o --exclude-standard
gives untracked files, so you can do something like below ( or add an alias to it):
git add $(git ls-files -o --exclude-standard)
It's easy with git add -i
. Type a
(for "add untracked"), then *
(for "all"), then q
(to quit) and you're done.
To do it with a single command: echo -e "a\n*\nq\n"|git add -i
Not exactly what you're looking for, but I've found this quite helpful:
git add -AN
Will add all files to the index, but without their content. Files that were untracked now behave as if they were tracked. Their content will be displayed in git diff
, and you can add then interactively with git add -p
.