Commit and update

Sharing you modification with other users and updating your local copy with modifications made by other users.

  • svn update: update working copy i.e. copy latest revisions from repository to your working copy
  • svn commit: copy your changes to the repository
  • svn add, svn delete, svn copy, svn move: self-explanatory
  • svn revert: undo changes

In the previous page, we checked out a directory with the following command:

$ cd ~
$ svn checkout file:///home/me/svnrepos/trunk xml-project

Now we create another local working copy

$ cd ~
$ svn checkout file:///home/me/svnrepos/trunk xml2-project

We will be editing the file painting.xml which looks like the following the repository

$ svn cat file:///home/nazim/svnrepos/trunk/painting.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE painting SYSTEM "painting.dtd">
<painting>
<name>Mona Lisa</name>
<painter>Leonardo da Vinci</painter>
<year>1504</year>
</painting>

svn cat command prints the contents of the file in the repository to screen. To edit the file, you can use vi, gedit or any other editor. Change the year in the file from 1504 to 1506 and save the file. Once you have edited and saved the file, you can commit it to the repository with the following command.

$ cd ~/xml-project
$ svn commit -m "changed painting year"

Now the painting.xml file in the local working copy xml-project and the repository are identical. However, the copy in the local working directory still has the older version of paintings.xml. To update this file, in the xml2-project, we need to use the following command:

$ cd ~/xml2-project
$ svn update

Now the programmer using xml2-project has the updated versions of painting.xml committed by the programmer using xml-project local working copy.


buy cheap generic viagra online