svn related

Frequently svn commands

  1. svn up
  2. svn add/delete
  3. svn update -r 1234  (this is to revert local copy to certain revision instead of head revision)
  4. svn revert --recursive .  (this is revert all local changes)
  5. svn diff* svn cleanup
  6. svn status | grep ^\? | cut -c9- | xargs -d \\n rm -r  (this will remove all unversioned files and folders from local copy)


How to properly add new files to svn repository?

  • never never copy-n-paste a existing folder in your svn checkout; by doing so, you are copying the svn meta data together with source code, and potentially screw up your local copy completely.
  • the right way is to create a new folder manually and then copy source files into it.
  • next, use 'svn add' to schedule them for checking in.
  • until then, 'svn diff' will correctly reflect all your local changes including file addition and deletion.


Creating and applying patch

  • svn diff >mypatch.diff
  • patch -p0 -i mypatch.diff