‘git add –patch’ to include new files?


When I run git add -p, is there a way for git to select newly made files as hunks to select??

So if I make a new file called foo.java, then run git add -p, git will not let me choose that file’s content to be added into the index.


To include every new files, you can run:

If you want to use it frequently, you can create an alias in your ~/.bashrc:

N.B: If you use this with an empty new file, git will not be able to patch it and skip to the next one.

Leave a Reply