Saturday, September 08, 2007

My first version control

Ok, now we've got our versioning control server up and running. Now what? Now we start using it. I'll list the more basic command/uses here using the CLI. If you like, you can check out some other documentation on SVN.

  • Creating a repository
    • Log in to svn_srv
    • svnadmin create --fs-type fsfs /path/to/svn/repository_name
    • chgrp -R svn /path/to/svn/repository_name
    • cdmod -R 770 /path/to/svn/repository_name
    • cd /path/to/svn/repository_name/conf
    • Edit the svnserve.confauthz and passwd file appropriately if you wish to disallow anonymous access and only allow authorized users to access your repository (recommended).

  • Importing an existing project to the above created repository
    • svn import /path/of/existing/project/folder svn://svn_srv/repository_name --username user_in_authz_file -m "Log message"

  • Downloading a fresh copy of the repository
    • svn checkout svn://svn_srv/repository_name /destination --username user_in_authz_file

  • Sync-ing a local copy with the changes in the repository
    • svn update --username user_in_authz_file  [-r revision_we_want_to_sync_with]

  • Show exact changes in files which have changed from repository and your local copy
    • svn diff --username user_in_authz_file [-r revision_we_want_to_compare_with]

  • Show things which have changed on your local copy and the repository
    • svn status -u

  • Adding new files to be added to the version control (recursively adds files and folders)
    • svn add * --force

  • Merging changes from two sources to the current copy
    • svn merge --username user_in_authz_file --no-auth-cache -r revision_to_merge_to:revision_to_merge_from /path/to/changed/copy
    • svn merge --username user_in_authz_file --no-auth-cache  URL@revision_1 URL@revision_2 /working/copy/path

  • Deleting a file from the local copy or in the repository
    • svn delete svn://svn_srv/repository_name/file
    • svn delete path/to/file
  • Undo all local changes (does not work with removed directories)
    • svn revert --recursive
    • svn revert path/to/file
  • Commit your changes to the repository
    • svn commit


By no means is the above a complete list of options or things you can do with SVN. Read the documentation and try it out for yourself to see the power of this tool.Or, if all this looks too complicated, we could use a GUI for it. Some of the are listed below :-

No comments: