Linux SVN Commands

Aug 3, 2015


  1. Create a repository:
svnadmin create /svn/foo/mydirname
  1. Want to version control /home/user/mydirname:
cd /home/user/mydirname
  1. This only creates the “.svn” folder for version control:
svn co file:///svn/foo/mydirname .
  1. Tell svn you want to version control all files in this directory:
svn add ./*
  1. Check the files in:
svn ci
  1. Check file in with comment:
svn ci -m "your_comment"
  1. Checkout project
cd /home/user/projectx
svn checkout file:///svnrepo/projectx .
  1. 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
  1. Add all files:
svn add --force path/to/dir
svn add --force .
  1. 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
  1. Ignore a directory:
svn propset svn:ignore dirname .
  1. Ignore a directory if already checkin using file.txt:
svn rm --keep-local dirname
svn propset svn:ignore -F file.txt .
  1. 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/