开发者

Simple SVN commands

Seemingly lame question, but I've been through all the docs and tutorials and am unable to figure out exactly what I want.

My repo is https://sourcerepo.something/mystuff

My working folder is

/var/www

I copy new files into

/var/www (that are not under source control since they are new)

I revise some files in

/var/www (that are already under source control)

What command would I use to add new and updated files?

What command would I use to subsequently commit?

The command

svn add /var/www/

will add all files, even the unchanged files that are already under source control. I get a thousand messages warning that the files are "already under source control"

What command开发者_如何转开发line would I use to just add new and updated files?

Thanks so much.


I would recommend:

$ svn status

Will give you status of all files, including those that need to be added.

$ svn add /var/www/only/new/files

And finally:

$ svn commit


Just use

svn add newfilename

Later when you next commit, they will be added to the repository. If you do this a lot it might be a good idea to make a shell alias or script that does the copy and svn add for you.


Use svn --force to force it to do this. Note that you don't add modified files, you simply commit the changes.

Be careful, though. Doing a blanket add is a good way to end up with all sorts of crud in your SVN repository.


You can make "svn add" shut up by passing the "-q" or "--quiet" flag. As well as not complaining about unchanged files, it will then also not tell you about the ones it is adding, but you can do "svn status" to see what it's done.

No need to add updated files -- "add" means to make files version-controlled that weren't before. "svn commit" will automatically commit the changes you've made to already-version-controlled files.


I have the perfect little gem for you.

svn status | grep "^?" | awk '{print $2}' | xargs svn add

This basically says do "svn status" then get all the NEW fils marked as "?" bunch them together and then do an "svn add" on the list.

After that you just need to do your commit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜