When to use import in SVN?
If I want to upload a file in my working directory, I just add the files and then commit the file to the server. However, can I use import to accomplish this? What's the difference between 开发者_开发技巧import and add/commit?
An import saves you one step: add
and commit
become a single import
. A regular commit allows you to review changes in your working copy before committing them to the repository.
You cannot import a file that is already under version control. Apart from that, there aren't other major differences I can think of.
Depending on your Subversion client, one procedure may be harder than the other. In any case, you normally use import to upload legacy or third-party code and regular commits to upload your work.
To add to @Alvaro's answer, from svn import documentation,
svn import
creates parent directories that do not exist.
After importing data, the original tree is not under version control.
The import is made from non-versioned files/directories.
The commit updates changes in your repo based on you versioned file structure.
They have completely different uses. Look at http://svnbook.red-bean.com/en/1.0/ch01s07.html for a typical scenario.
精彩评论