ram chander
ram chander

Reputation: 131

How can I add an empty directory to a SVN repository?

I have checked out the code from SVN repo and I have created couple of empty directories to it, but I am not able to commit them. Do we have any other command to commit empty directories ?

Right now I am using the command below, but no response.

svn commit -m "Comments"

Thanks in advance

Upvotes: 5

Views: 6249

Answers (3)

Suresh
Suresh

Reputation: 1523

If you have created the directories using the OS provided command then SVN would not be able to automatically schedule it for commit. In that case you would have to do an "svn add" yourself before running the "svn commit" command.

/myrepo/trunk/test>mkdir lib
/myrepo/trunk/test>svn status
? lib
/myrepo/trunk/test>svn add lib
A lib
/myrepo/trunk/test>svn commit -m "adding lib"
Adding test/lib
Committed revision 19.

Alternatively, you can use svn mkdir. This essentially does "mkdir" followed by "svn add". Save a step.

/myrepo/trunk/test>svn mkdir doc
A doc
/myrepo/trunk/test>svn commit -m "adding doc"
Adding testbox/doc
Committed revision 20.

Upvotes: 0

Joe L.
Joe L.

Reputation: 1908

Since you have tortoisesvn tagged in your question, I'll give you that approach:

  1. Create the folder as you normally would.

  2. Right click on the folder and select TortoiseSVN-->Add... to add the folder to your SVN working copy.

  3. Now when you commit, your folder will be included in the changes that you will be committing.

Upvotes: 4

crashmstr
crashmstr

Reputation: 28573

Sounds like svn mkdir is what you want.

Create a directory with a name given by the final component of the PATH or URL. A directory specified by a working copy PATH is scheduled for addition in the working copy. A directory specified by a URL is created in the repository via an immediate commit. Multiple directory URLs are committed atomically. In both cases, all the intermediate directories must already exist unless the --parents option is used.

Create a directory in your working copy:

$ svn mkdir newdir
A         newdir

Create one in the repository (this is an instant commit, so a log message is required):

$ svn mkdir -m "Making a new dir." http://svn.red-bean.com/repos/newdir

Committed revision 26.

Upvotes: 4

Related Questions