====== SVN ======
**General Information**
Subversion (svn) is a "free/open-source version control system".
**Checklist**
* Distro(s): Any
* Package: svn installed
----
====== Create ======
Create a working directory space.
----
===== Checkout Repo =====
Checkout creates a local copy of the repo.
Checkout command
svn checkout URL
Shortcut
svn co URL
----
====== Modify ======
Make changes to a repo.
----
===== Update =====
Update changes from the repo to your local copy.
svn update
----
===== Add File =====
Add a new file/directory to the repo. New file only gets pushed to the repo copy upon commit.
- Create a new file/directory locally
- Add the file with svnsvn add mynewfile
- Commit the added file to the reposvn commit -m "Adding a new file to the project." mynewfile
----
===== Delete File =====
Delete a file from the working copy. The file will be removed from the repo upon commit.
- Delete file via svnsvn delete mynewfile
- Commit the deletion to remove from the reposvn commit -m "removing mynewfile." mynewfile
----
===== Move File =====
Move or rename a file. File is changed in the repo upon commit.
- Move/rename a filesvn move oldfilename newfilename
- Commit move/renamesvn commit -m "Renaming my file" newfilename
----
===== Commit =====
A commit saves changes to the repo.
Commit command
svn commit -m "my changes description"
----
===== Cleanup =====
Keep your working directory clean by listing and/or removing untracked files.
List untracked filessvn status --no-ignore | grep '^?' | awk '{print $2}' | xargs -I{} ls -l '{}'
\\
**WARNING**: The following could remove work in progress!
Remove untracked filessvn status --no-ignore | grep '^?' | awk '{print $2}' | xargs -I{} rm -fv '{}'
----
====== Inspect ======
View status and logs.
----
===== Diff =====
Show the differences between your working copy and the repo copy.
svn diff myfilename
----
===== Status =====
Show the status of the file(s) in the working copy.
svn status PATH
Show the character codes for various statuses
svn help status
----
===== Log =====
View logged commits.
svn log PATH
\\
View diff of a specific logged revision
svn log --revision r101 --diff
----