I often use git add -p
when adding updates ready to be committed.
However, is it possible to do the same for new files too? It does not appear to be and only limited to edits to existing files.
I often use git add -p
when adding updates ready to be committed.
However, is it possible to do the same for new files too? It does not appear to be and only limited to edits to existing files.
The command git add
is used to add a new file to the repository AND to tell Git that you want a file that has changed to be in the next commit.
This has lots of advantages, because a git commit only commits those files that have been explicitly added. Note with SVN add is used only to add new files to the repo.
-p, --patch Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index.