wiki:cypress/Programming/Svn)

Version Control with Subversion (svn)

What is SVN?

  • A free/open-source version control system.
  • Managing files and directories over time, placed into a central repository.
  • The repository remembers every changes ever made to the files and directories.
  • Accessible across networks, allowing to be used on different computers.
  • Runs on Many platforms.

Home Page

Good things…

  • If you develop a software with some other people, it keeps track of who did what when and where changes.
    • even if you develop a software yourself…
  • When you made a stupid change and screwed up ….
    • Allows you to go back.
    • Revert to a previous revision of a file/directory.

First things to do

Create a repository

svnadmin create $HOME/repos

This creates a repository under '$HOME/repos'.

Note that $HOME is your home-directory on Cypress.

Once you did this, you don't have to do this again. Do not delete '$HOME/repos' !!!

Testing your repository

On Cypress,

mkdir mywork
cd mywork
mkdir project1
echo "This is README.txt" > README.txt 
svn import file:///$HOME/repos/project1 -m"initial import"

Now you have project1 in your repository.

Delete project1 then checkout project1 from the repository,

cd ..
rm -rf project1
svn co file:///$HOME/repos/project1 ./project1

Working with SVN

  • To download files in a repository, use 'svn checkout' / 'svn co' command.
  • If you made some changes to the files in your local machine and want to upload these to the repository, use 'svn commit' command.
  • If you have files on your local machine and want to update these to the latest version in the repository, use 'svn update' command.
  • If you want to add a file/direcotry, use 'svn add' and commit.
  • If you want to delete a file/directory, use 'svn delete' and commit.

What to Control

  • Source Code
  • Documents
  • Variable data
  • Anything you want to share that isn't essentially static data.

Do not upload…. Large sets of binary files; images, movie, music….



Tutorial::Accessing your Repository over Network

To access your Repository on Cypress through ssh from other hosts,

svn co svn+ssh://USERNAME@cypress1.tulane.edu/HOME_DIRCTORY/repos/project1 ./project1

You will be asked for typing your password.

USERNAME and HOME_DIRCTORY are your login user name and home directory on Cypress.

To see the path of your home directory, on Cypress

cat $HOME

Try using Your Repository

Check out data

Somewhere on Cypress,

svn co file:///$HOME/repos/project1 ./project1

go into project1 directory.

cd project1

look at files

ls

Edit README.txt

Edit README.txt to add your message.

then commit it.

svn commit -m"your message"

When you made a stupid change or delete a file by mistake

You can revert to a previous version.

To look at the log

svn log

If you want to download version 1,

svn -r 1 update

When you delete README.txt by mistake,

rm README.txt

See the file you deleted does not exist.

ls

Download the missing file,

svn update

Add files

Make a new file, then add it to svn by

svn add NEW_FILE_YOU_MADE

then

svn commit -m"your message"

Check status

To check the status

svn stat

To see the difference between the repository and your working version

svn diff

Upload ==

To upload your working version to the repository,

svn commit -m"comment for current version"

Look at the status and difference

svn stat
svn diff

Help

svn help
Last modified 9 years ago Last modified on 08/18/15 22:56:09

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.