Reema
Reema

Reputation: 647

Difference between `svn add` and `svn commit` in Apache Subversion

What is the difference between Add and Commit in SVN?

I understand that Add adds a new file to SVN and Commit updates any changes done for an already existing file in the SVN

My question is, do I need to do a Commit after adding new files using Add?

Upvotes: 5

Views: 17431

Answers (2)

bahrep
bahrep

Reputation: 30662

There is a great chapter in SVNBook which describes basic workflow with Subversion: SVNBook | Basic Work Cycle. The chapter explains, that svn add et all are commands related to making changes and svn commit is a command which publishes these changes to a repository as a new revision.

  • svn add adds an item (file or directory) to a local working copy. svn add is a local operation and does not contact server. No changes made to a repository when you run svn add. It simply schedules and item to be committed to a repository next time your run svn commit.

  • svn commit commits changes to a repository.

Upvotes: 7

theone
theone

Reputation: 13

SVN Add:

When you are creating a new file or directory, you need to tell the SVN server about it. This command does that.

SVN Commit:

This command recursively sends your changes to the SVN server. It will commit changed files, added files, and deleted files. Note that you can commit a change to an individual file or changes to files in a specific directory path by adding the name of the file/directory to the end of the command.

Go here for an SVN Command guide.

Upvotes: -3

Related Questions