svn checkout http://svn.collab.net/repos/svn/trunk subversion svn co http://svn.collab.net/repos/svn/trunk subversion This command will check out a working copy of the subversion source code into a new subdirectory called subversion. something different. svn checkout –username myuser –password …… svn update Equivalent to bzr pull. svn update -r 123 svn stat (svn st) Equivalent to bzr status. svn revert This will revert the changes svn diff filename.cpp This will show the diff svn revert -R * This will revert all changes svn -v list This will list the files in source control svn -v list http://svn.collab.net/repos/svn/trunk This will list all files in source control. Can do before checkout. svn -v list http://url/repos/tags/ This will list available tags. svn info Gives you info about the current working copy, svn commit -m “Adding new function” filename.cpp Commit the changes in filename.cpp svn commit -m “Adding lots of new functions” commit all changes svn log svn log filename.cpp svn log –limit 5 http://svn.collab.net/repos/svn/trunk Use this function to take a look at the log messages. svn add newfile.cpp Add a file or directory to version control. svn move filename.cpp newfilename.cpp Allows you to rename. svn delete filename.cpp Deletes the filename svn blame filename.cpp List every line with author name. Code into Subversion svn import -m “Importing the files” MySource http://svn.theserver.net/svnroot/mysource : Imports the directory MySource and all files contained within into the subversion server. Administrators svnadmin create /svnroot/RepositoryName Creates a new repository svnadmin hotcopy /svnroot/reponame /backups/reponame Makes a “Hot Copy” of the repository seems to work pretty well for full backups. svn copy -m “Making a new branch for that new feature” http://svn.server.com/svnroot/trunk http://svn.server.com/branches/johnnysbranch Make a branch copy of the trunk into a seperate branch. svn copy -m “Tagging version 1.0″ http://svn.server.com/svnroot/trunk \ http://svn.server.com/svnroot/versions/version_1.0 Tag a version of the application. This uses the same copy command that the branching does, and it’s really the same underlying operation. Copying in subversion does not actually make a new copy of the file, it just tags the current version. Once changes are made, then the changes would be stored to the file seperately. Tutorial: cd /home/thava/tmp svnadmin create svn svn mkdir file:/home/thava/tmp/svn/myproj svn help: ============================================================================ Tip: subversion branches are like ordinary directories. Branches use "/branches" dir by convention by this can be anything else. ============================================================================ Tip: Changeset for subversion is the global revision number N. This is Nth commit. If you commit revision 100 to /branches/branch1 and 101 to /branches/oldbr The changes may be completely unrelated but still will be sequential. Note that single branch will have discrete revision numbers checked in. ============================================================================ Tip: To copy the latest changes from trunk to your current branch, do: svn merge http://svn.example.com/repos/calc/trunk --- Merging r345 through r356 into '.': U button.c U integer.c ============================================================================ Tip: To remove a branch do: svn delete http://..../branches/my-old-branch To remove a tag do: svn delete http://..../tags/mytag ============================================================================ Tip: use --dry-run option: svn merge http://svn.example.com/repos/calc/trunk --dry-run ============================================================================ Tip: Undo changes: svn merge -revision 101:100 url; svn merge -c -101 url; svn commit; Note: There is no "uncommit" command for svn. ============================================================================ Tip: Retrieve specific file of specific revision: svn copy http://.../trunk/real.c@807 ./real.c svn cat http://.../trunk/real.c@807 > ./real.c ============================================================================ Tip: Display the pending merge info of working copy: $ svn propget svn:mergeinfo . /trunk:341-349,355 ============================================================================ Tip: Block changeset: Just make subversion believe that the change is already merged: svn propget svn:mergeinfo . svn merge -c 1001 --record-only url svn status ============================================================================ Tip: Create a simple tag: svn copy http://svn.example.com/repos/calc/trunk \ http://svn.example.com/repos/calc/tags/release-1.0 \ -m "Tagging the 1.0 release of the 'calc' project." Committed revision 902. Note: if calc/tags dir does not exist, create it using svn mkdir; ============================================================================ Tip: You can resurrect deleted dir/tags ! $ svn delete http://url/branches/my-calc-branch \ -m "Removing obsolete branch of calc project." Committed revision 375. $ svn copy http://svn.example.com/repos/calc/branches/my-calc-branch@374 \ http://svn.example.com/repos/calc/branches/my-calc-branch \ -m "Restore my-calc-branch." Committed revision 376 ============================================================================ Tip: To access svn repository locally, use file:/// prefix! svn -v list file:///home/thava/tmp/svn ============================================================================ Tip: Run svn server on default port 3690/tcp : svnserve -d [-r /var/svn] runs this as daemon with root repository /var/svn; If -r /var/svn is omitted, / and *all* subdirs in system will be exported! Note: /var/svn may be a plain dir with subdirs which are repositories: svn co svn:://localhost ; may fail if /var/svn is not a repo; svn co svn:://localhost/svn1; may succeed if /var/svn/svn1 is a repo; ============================================================================ Tip: List all properties on an object using "svn proplist" You can attach user-defined arbitrary properties with files!!! e.g. svn proplist ============================================================================ Tip: Resolve conflicts: svn status svn update Conflict discovered $ls -1 one.txt one.txt.mine one.txt.r1 // oldversion one.txt.r2 // new version To accept repo version: $ svn resolve --accept theirs-full one.txt ============================================================================ Tip: Use svn:externals property to include external repository directories. svn propget svn:externals proj_root_dir1 dir2 dir3 ... subdir/dir1 http://..../dir1 subdir/dir2 http://..../dir2 svn propset svn:externals .... targetdir svn propedit svn:externals .... targetdir ============================================================================