-
Notifications
You must be signed in to change notification settings - Fork 1
VersionControlWithSubversion
The official documentation is here. Takes a while to read, though.
Initial checkout :
$ svn co https://newxmipp.svn.sourceforge.net/svnroot/newxmipp/trunk
This will create thetrunk directory under the current directory. Add a name to create under a different dir.
Typical work cycle:
1- Update your working copy
svn update
2- Make changes. Use the subversion commands for tree changes
-
$EDITORfor normal edits -
svn addto schedule file/directory addition. Recursive unless--non-recursiveflag is used -
svn deleteto schedule file/directory for deletion -
svn copyto duplicate item, including history -
svn moveto schedule acopy + deleteoperation
3- Examine your changes. Note all three do NOT require a network connection.
-
svn statusMost frequent command -
svn diffShow exact changes in local version (add-r revision_number) to compare to a revision that is not the current one. -
svn revertUndo any scheduled operation
4- Merge others' changes
-
svn updateShows conflicts (marked withC). Creates three files:.mine.r$OLD.r$NEW
-
Options:
- Merge by hand
- Copy one temporary over your working file
- Run revert $FILE to throw away your changes
-
svn resolvedLet subversion know things are settled. Removes the temporary files
5- Commit your changes
-
svn commit. Add a message with$EDITOR,--message(or-m) or--fileflags. For example,svn commit -m "I have made this and that changes" file_to_commit.txt
A few tips for CVS users:
-
- Do not use
update -nto check your status, use.. well..status
- Do not use
-
- Rearrange your repository as much as needed, with
move + commit
- Rearrange your repository as much as needed, with
-
- Tags and branches are done with
copynow. By convention, tags live under/tagsand branches live under/branches
- Tags and branches are done with
-
- Use
revertinstead ofdelete + update
- Use
-
- Remember subversion will never ever ever do anything to your data unless you ask it to, including binary files
-
- Subversion's
logis actually useful, check it
- Subversion's
Revert to a previous version (from http://aralbalkan.com/1381)
if you want to revert the trunk of your application from revision 73 to 68, you would do the following:
* svn merge --dry-run -r:73:68 https://newxmipp.svn.sourceforge.net/svnroot/newxmipp/trunk * svn merge -r:73:68 https://newxmipp.svn.sourceforge.net/svnroot/newxmipp/trunk * svn commit -m "Reverted to revision 68."
Step 1 will perform a dry run and show you what the merge will produce. If you want to see exactly what changes will be applied, do a diff:
svn diff -r:73:68 https://newxmipp.svn.sourceforge.net/svnroot/newxmipp/trunk
Step 2 actually performs the merge (you'd do this after you're happy with the dry run). At this point, realize what is happening: Subversion is calculating the changes between revision 73 and revision 68 of the trunk and applying them to your working copy. For the majority of the time, you will thus want your working copy to be a fully updated copy of the revision you are reverting from (in this example, revision 73).
Finally, since the merge happens on your local working copy, you need to commit it to the repository in Step 3.
--Main.AlfredoSolano - 26 Mar 2007