14 | | svn co https://svn.orxonox.net/data/trunk data |
| 41 | #!html |
| 42 | <pre class="wiki" style="white-space:normal;"> |
| 43 | svn co https://svn.orxonox.net/data/trunk data<br/> |
| 44 | svn up<br/> |
| 45 | svn ci -m "some message"<br/> |
| 46 | svn add myFile.cc myFile.h<br/> |
| 47 | svn rm trash-folder<br/> |
| 48 | svn mv myFile.cc myFile.h myFolder<br/> |
| 49 | svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test<br/> |
| 50 | svn resolved somefile.cc<br/> |
| 51 | svn revert<br/> |
| 52 | svn diff<br/> |
| 53 | </pre> |
| 54 | }}} |
| 55 | |
| 56 | Read the [http://svnbook.red-bean.com/en/1.1/index.html official guide to subversion] or its [http://www.onlamp.com/pub/a/onlamp/2002/10/31/subversion.html shorter version] for further information. |
| 57 | |
| 58 | If not noted otherwise all commands are recursive. |
| 59 | {{{ |
| 60 | #!html |
| 61 | </td> |
| 62 | </tr> |
| 63 | </table> |
| 64 | </td> |
| 65 | </tr> |
| 66 | </table> |
| 67 | |
| 68 | <table width=100% border=0 cellpadding=10 cellspacing=5> |
| 69 | <tr valign=top> |
| 70 | <td width=100%% style="background-color:#F7F7F7;border:1px solid #888888;"> |
| 71 | <h3 style="margin:0;">checkout (co)</h3> |
| 72 | }}} |
| 73 | |
| 74 | The checkout command is used to create a local copy of a svn subtree on the local computer. |
| 75 | |
| 76 | The syntax used is ''svn co -r <revision> <remote-path> <local-path>'', if -r <revision> is omitted, the HEAD revision is assumed, which is also the newest one, if <local-path> is omitted the last remote folder will be used as <local-path>. |
| 77 | |
| 78 | This will create a folder orxonox-trunk with the contents of the trunk |
| 79 | {{{ |
| 80 | svn co https://svn.orxonox.net/orxonox/trunk orxonox-trunk |
| 81 | }}} |
| 82 | |
| 83 | This will create a folder called test, with the content of the test branch at revision 200. |
| 84 | {{{ |
| 85 | svn co -r 200 https://svn.orxonox.net/orxonox/branches/test |
| 86 | }}} |
| 87 | {{{ |
| 88 | #!html |
| 89 | <hr style="margin:0px;"> |
| 90 | <br/> |
| 91 | <h3 style="margin:0;">update (up)</h3> |
| 92 | }}} |
| 93 | Update is closely related to checkout, as it also download - or updates - the svn tree. while checkout is normally only used once, update is used all the time. |
| 94 | |
| 95 | The syntax is ''svn up <local-path>'', if <local-path> is omitted the current update will be allied to the current directory. |
| 96 | |
| 97 | This will update the current folder including subfolders. |
| 98 | {{{ |
16 | | svn ci -m "some message" |
17 | | svn add myFile.cc myFile.h |
18 | | svn rm trash-folder |
| 100 | }}} |
| 101 | |
| 102 | This will update the trunk and the test-branch. |
| 103 | {{{ |
| 104 | svn up trunk branches/test |
| 105 | }}} |
| 106 | |
| 107 | Updates may cause conflicts if the remote and local file has been changed in the same place. to resolve a conflict see [wiki:SVN#resolved here]. |
| 108 | {{{ |
| 109 | #!html |
| 110 | <hr style="margin:0px;"> |
| 111 | <br/> |
| 112 | <h3 style="margin:0;">commit (ci)</h3> |
| 113 | }}} |
| 114 | Sometimes also called checkin, does the opposite of checkout or update, it upload changes made to the local copy to the server. |
| 115 | |
| 116 | The syntax is ''svn ci -m <commit message> <local-path>'', if <local-path> is omitted, the current directory is assumed, if -m <commit message> is ommited, an editor will pop up where you can (and should) write a meaningful commit message. |
| 117 | |
| 118 | This will checkin the current directory including subfolders with the comment "initial upload" |
| 119 | {{{ |
| 120 | svn ci -m "initial upload" |
| 121 | }}} |
| 122 | |
| 123 | A commit is only possible if the local version is up-to-date. If it isn't you will get an error, and the commit will fail. The solution then is to do an [wiki:SVN#updateup update]. |
| 124 | {{{ |
| 125 | #!html |
| 126 | <hr style="margin:0px;"> |
| 127 | <br/> |
| 128 | <h3 style="margin:0;">add</h3> |
| 129 | }}} |
| 130 | Adding a new file to the local svn copy, that it gets uploaded with the next commit. |
| 131 | |
| 132 | |
| 133 | The syntax is ''svn add <file>'' |
| 134 | |
| 135 | This will add the files myFile.cc and myFile.h in the folder myFolder to the svn |
| 136 | {{{ |
| 137 | svn add myFolder/myFile.cc myFolder/myFile.h |
| 138 | }}} |
| 139 | {{{ |
| 140 | #!html |
| 141 | <hr style="margin:0px;"> |
| 142 | <br/> |
| 143 | <h3 style="margin:0;">remove (rm)</h3> |
| 144 | }}} |
| 145 | Also called delete (del), which deletes an item from the svn tree. Please note that this also removes the file/folder from the local harddrive. |
| 146 | |
| 147 | The syntax is ''svn rm <file/folder>''. |
| 148 | |
| 149 | This will remove the file myOldFile.cc from the svn tree |
| 150 | {{{ |
| 151 | svn rm myOldFile.cc |
| 152 | }}} |
| 153 | {{{ |
| 154 | #!html |
| 155 | <hr style="margin:0px;"> |
| 156 | <br/> |
| 157 | <h3 style="margin:0;">move (mv)</h3> |
| 158 | }}} |
| 159 | Sometimes called rename (ren) - as a rename is the same as a move. The command simplifies the rearranging of files in the svn tree. |
| 160 | |
| 161 | The syntax is ''svn mv <source files> <target-folder>'' |
| 162 | |
| 163 | This will move the files myFile.cc and myFile.h to myFolder |
| 164 | {{{ |
21 | | svn resolved somefile.cc |
22 | | svn revert |
23 | | svn diff |
24 | | }}} |
25 | | |
26 | | Read the [http://svnbook.red-bean.com/en/1.1/index.html official guide to subversion] or its [http://www.onlamp.com/pub/a/onlamp/2002/10/31/subversion.html shorter version] for further information. |
27 | | |
28 | | If not noted otherwise all commands are recursive. |
29 | | ---- |
30 | | === checkout (co) === |
31 | | The checkout command is used to create a local copy of a svn subtree on the local computer. |
32 | | |
33 | | The syntax used is ''svn co -r <revision> <remote-path> <local-path>'', if -r <revision> is omitted, the HEAD revision is assumed, which is also the newest one, if <local-path> is omitted the last remote folder will be used as <local-path>. |
34 | | |
35 | | This will create a folder orxonox-trunk with the contents of the trunk |
36 | | {{{ |
37 | | svn co https://svn.orxonox.net/orxonox/trunk orxonox-trunk |
38 | | }}} |
39 | | |
40 | | This will create a folder called test, with the content of the test branch at revision 200. |
41 | | {{{ |
42 | | svn co -r 200 https://svn.orxonox.net/orxonox/branches/test |
43 | | }}} |
44 | | ---- |
45 | | === update (up) === |
46 | | Update is closely related to checkout, as it also download - or updates - the svn tree. while checkout is normally only used once, update is used all the time. |
47 | | |
48 | | The syntax is ''svn up <local-path>'', if <local-path> is omitted the current update will be allied to the current directory. |
49 | | |
50 | | This will update the current folder including subfolders. |
51 | | {{{ |
52 | | svn up |
53 | | }}} |
54 | | |
55 | | This will update the trunk and the test-branch. |
56 | | {{{ |
57 | | svn up trunk branches/test |
58 | | }}} |
59 | | |
60 | | Updates may cause conflicts if the remote and local file has been changed in the same place. to resolve a conflict see [wiki:SVN#resolved here]. |
61 | | ---- |
62 | | === commit (ci) === |
63 | | Sometimes also called checkin, does the opposite of checkout or update, it upload changes made to the local copy to the server. |
64 | | |
65 | | The syntax is ''svn ci -m <commit message> <local-path>'', if <local-path> is omitted, the current directory is assumed, if -m <commit message> is ommited, an editor will pop up where you can (and should) write a meaningful commit message. |
66 | | |
67 | | This will checkin the current directory including subfolders with the comment "initial upload" |
68 | | {{{ |
69 | | svn ci -m "initial upload" |
70 | | }}} |
71 | | |
72 | | A commit is only possible if the local version is up-to-date. If it isn't you will get an error, and the commit will fail. The solution then is to do an [wiki:SVN#updateup update]. |
73 | | ---- |
74 | | === add === |
75 | | Adding a new file to the local svn copy, that it gets uploaded with the next commit. |
76 | | |
77 | | |
78 | | The syntax is ''svn add <file>'' |
79 | | |
80 | | This will add the files myFile.cc and myFile.h in the folder myFolder to the svn |
81 | | {{{ |
82 | | svn add myFolder/myFile.cc myFolder/myFile.h |
83 | | }}} |
84 | | ---- |
85 | | === remove (rm) === |
86 | | Also called delete (del), which deletes an item from the svn tree. Please note that this also removes the file/folder from the local harddrive. |
87 | | |
88 | | The syntax is ''svn rm <file/folder>''. |
89 | | |
90 | | This will remove the file myOldFile.cc from the svn tree |
91 | | {{{ |
92 | | svn rm myOldFile.cc |
93 | | }}} |
94 | | ---- |
95 | | === move (mv) === |
96 | | Sometimes called rename (ren) - as a rename is the same as a move. The command simplifies the rearranging of files in the svn tree. |
97 | | |
98 | | The syntax is ''svn mv <source files> <target-folder>'' |
99 | | |
100 | | This will move the files myFile.cc and myFile.h to myFolder |
101 | | {{{ |
102 | | svn mv myFile.cc myFile.h myFolder |
103 | | }}} |
104 | | |
105 | | This will rename the file myFiel.cc to myFile.cc - to correct a typo. Please note the mv and rename are the same command |
106 | | {{{ |
107 | | svn ren myFiel.cc myfile.cc |
108 | | }}} |
109 | | ---- |
110 | | === copy (cp) === |
111 | | A command which is rarely used on the local tree - why would someone need a file twice in the same tree? - but it is rather useful to create new branches. Though it is normally done by the supervisors, it can be done by the students. |
112 | | |
113 | | The syntax is ''svn cp <source-tree> <target-tree>'' or ''svn cp <source-files> <target>'' |
114 | | |
115 | | This will create a new branch called test from the current version of the trunk |
116 | | {{{ |
117 | | svn cp https://svn.orxonox.net/orxonox/trunk https://svn.orxonox.net/orxonox/branches/test |
118 | | }}} |
119 | | ---- |
120 | | === resolved === |
| 185 | }}} |
| 186 | {{{ |
| 187 | #!html |
| 188 | <hr style="margin:0px;"> |
| 189 | <br/> |
| 190 | <h3 style="margin:0;">resolved</h3> |
| 191 | }}} |