Subversion (Svn) Cheat Sheet

ADVERTISEMENT

Subversion Cheat Sheet
Basic Work Cycle
Update to the latest revision
checkout,
update
Do your work, change files
add, remove, copy,
move
Examine changes
status, diff,
revert
Merge your work
update,
resolved
Commit
commit
-m "your comment"
The Repository
The repository (repo) manages all versions (revisions) of your project. You can't work on files of a repo, you do a
checkout to get a working copy from a repository, do your work there, and commit your changes back to the repo.
Create a repository
svnadmin
create
/path/to/repo
The Working Copy
This is where your work is done. You may work with the files as with standard files, but leave those ".svn" directories
alone. Renaming, moving, copying, adding or deleting files and directories has to be done through svn additionally
to creating them, to tell the versioning system that those files are also part of the project (e.g. touch info.txt &&
info.txt). Else they will be missing after or recreated with the next checkout.
svn
add
You most likely want to execute these commands with the working copy as your current directory (PWD).
Get a working copy (= checkout)
svn (checkout|co) [-r REV] url://repo/path/ path/to/project
Update your working copy *1
svn (update|up) [-r REV] [path/to/project]
Add a file/directory to the project (!= import)
svn
add
path/to/fileOrDirectory
Copy a file/directory and mark it as added
svn
copy
path/to/fileOrDirectory path/to/newCopy
Rename/move a file/directory
svn (move|mv|rename|ren) path/to/dir path/to/newDir
Delete a file/directory
svn (delete|del|remove|rm) path/to/fileOrDirectory
Lock (or unlock) a file/directory for editing
svn (lock|unlock) path/to/fileOrDirectory
Check the status of your local file(s) *2
svn
status
[path/to/fileOrDirectory]
Compare the status to the repo *2
svn
status
-u
[path/to/fileOrDirectory]
Do a diff of your file(s) and the repo
svn
diff
[-r REV] [path/to/fileOrDirectory]
Revert to last revision (last checkout or update)
svn
revert
[path/to/fileOrDirectory]
Resolve conflicts (after you reviewed them!)
svn
resolved
[path/to/fileOrDirectory]
Commit and create a new revision
svn (commit|ci) [path/to/project] -m "your comment"
Import unversioned files/folders *3
svn
import
path/to/original url://repo/path/
Show a log
svn
log
[-r REV] [path/to/fileOrDirectory]
Concatenate a specific file
svn
cat
[-r REV] path/to/file

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2