takeshin takeshin - 1 year ago 135
Git Question

git: stage only new files

When I have:

  • dirty working directory,

  • dirty staging area,

  • and I copied some new files to the project,

how do I stage only the new ones?

git alias adduntracked=…

Answer Source

This alias will respect your ignore patterns (builtin, global and per-directory, as described by the help for git-ls-files --exclude-standard). It will run at the top level of your tree.

adduntracked=!git add $(git ls-files -o --exclude-standard)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download