Linux SVN Commands

Published: 03 Aug 2015 Category: linux_study

1. Create a repository:

$ svnadmin create /svn/foo/mydirname

2. Want to version control /home/user/mydirname:

$ cd /home/user/mydirname

3. This only creates the “.svn” folder for version control:

$ svn co file:///svn/foo/mydirname .

4. Tell svn you want to version control all files in this directory:

$ svn add ./*

5. Check the files in:

$ svn ci

6. Check file in with comment:

$ svn ci -m "your_comment"

7. Checkout project

$ cd /home/user/projectx
$ svn checkout file:///svnrepo/projectx .

8. Show only the last 4 log entries(need to “svn update” first in working copy directory)

$ svn update
$ svn log --limit 4
$ svn log -l 4

9. Add all files

$ svn add --force path/to/dir
$ svn add --force .

10. Checkout specified revision(1234 = some resivion number)

$ svn checkout svn://somepath@1234 working-directory
$ svn checkout -r 1234 url://repository/path
$ svn checkout -r 10 https://101.101.101.101/svn/SomeRepo

11. Ignore a directory

$ svn propset svn:ignore dirname .

12. Ignore a directory if already checkin using file.txt

$ svn rm --keep-local dirname
$ svn propset svn:ignore -F file.txt .

Specify a file that contains a list of file name patterns to ignore. Also, Use the -R (or –recursive) flag to specify that the command should be applied recursively:

.svnignore (like .gitignore):

bin gen proguard .classpath .project local.properties Thumbs.db *.apk *.ap_ *.class *.dex
$ svn propset svn:ignore -R -F .svnignore .

Reference

Getting svn to ignore files and directories

http://superchlorine.com/2013/08/getting-svn-to-ignore-files-and-directories/