-
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
-
$EDITOR
for normal edits -
svn add
to schedule file/directory addition. Recursive unless--non-recursive
flag is used -
svn delete
to schedule file/directory for deletion -
svn copy
to duplicate item, including history -
svn move
to schedule acopy + delete
operation
3- Examine your changes. Note all three do NOT require a network connection.
-
svn status
Most frequent command -
svn diff
Show exact changes in local version (add-r revision_number
) to compare to a revision that is not the current one. -
svn revert
Undo any scheduled operation
4- Merge others' changes
-
svn update
Shows 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 resolved
Let subversion know things are settled. Removes the temporary files
5- Commit your changes
-
svn commit
. Add a message with$EDITOR
,--message
(or-m
) or--file
flags. 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 -n
to 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
copy
now. By convention, tags live under/tags
and branches live under/branches
- Tags and branches are done with
-
- Use
revert
instead ofdelete + update
- Use
-
- Remember subversion will never ever ever do anything to your data unless you ask it to, including binary files
-
- Subversion's
log
is 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