How to update a file in SVN?

一个人想着一个人 提交于 2020-01-01 10:03:17

问题


Can anyone tell me the command for updating a file in the SVN repository. The file is already imported, I just want to modify the changes.

The file is main.css and the filepath /home/weblab/public_html/cake_1_2/app/webroot/css.

Can someone give me the exact command?


回答1:


I'm guessing that you have used "svn import" to get the files into the repository. If that is the case, then your local file on disk is not part of a working copy and you will not be able to "svn commit" it.

In order to verify this, run svn info from the directory your code is in. If it says: svn: '.' is not a working copy, your current directory is not a working copy.

What you then need to do is:

  1. svn checkout your project from the repository to a local working copy (temporary directory).
  2. copy your changes to the existing files over the working copy
  3. svn commit those changes.

After you've done that, rename the original project location (where you were working now) and move the working copy in it's place. You can now svn commit as normal from your working copy.

If the folder you use now is called: /home/username/myproject and the working copy is called /tmp/workingcopy. Then you could type the following:

  1. mv /home/username/myproject /home/username/myproject.old
  2. mv /tmp/workingcopy /home/username/myproject

Now continue your work in /home/username/myproject, you can delete myproject.old if you are sure all of your code is in the svn repository




回答2:


There's three ways to interpret your question:

  1. You only have the file in a subversion repository, and you want to modify its contents
  2. You have the file both in a repository and on disk, no changes done yet, and you want to modify its contents both places
  3. You have the file both in a repository and on disk, the file on disk contains changes, and you want to update the repository version with those changes

If the first, you need to first check out the file to a working copy on disk, then you move on to case 2.

If the second, you need to modify the file on disk with the changes, and then move on to case 3.

If the third, you need to commit the changes to the repository.

You do this with your chosen Subversion client. If this is the command line, a typical command looks like this:

svn ci -m "Text that describes the changes that were done"

The real problem here though is that you don't know how to use Subversion. I would find a Subversion tutorial and play around with it, create a temporary repository and put files into it, play around with the commit, checkout, revert, log, etc. commands to get a feel for how the system works.




回答3:


svn ci filename




回答4:


Quick answer: Use 'Commit'

Well, which OS, which client?

If on windows, TortoiseSVN is best.




回答5:


Using Mac OS, and having an Url link to SVN. Follow the steps

-Open terminal.

-change directory to needed path(ex: cd Desktop/).

-Type command: svn checkout url

 $MacBook-Pro:~ worktpg$ svn checkout http://stackoverflow.com/questions/

-Enter user name and password if prompted and wait for process to complete

-For Updating svn from terminal, cd to path and type command: svn update



来源:https://stackoverflow.com/questions/943665/how-to-update-a-file-in-svn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!