0

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.

Zombo
  • 1
  • 62
  • 391
  • 407
Marty Wallace
  • 34,046
  • 53
  • 137
  • 200

1 Answers1

-1

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.
Zombo
  • 1
  • 62
  • 391
  • 407
navins
  • 3,429
  • 2
  • 28
  • 29