Tuesday, October 19, 2010

Common subversion commands

Frequently used svn commands


To show the current working copy info

$ svn info


To show the list of files/directories added/modified locally

$ svn status


Various GREP options (Self explanatory)

$ svn status|grep M

$ svn status|grep ?


To show the status of given/file directory


$ svn status


Update the working copy

$ svn up


To compare local copy with the repository copy


$ svn diff


To compare local copy with the repository copy using external gui tool KOMPARE


$ svn diff |kompare -


Commit changes of individual file/files/directories


$ svn commit -m "commit message"


To commit all local changes of working copy:


$ svn commit -m


This will open up with the default editor bind with svn with the list of files. You can give your message here.


Rollback the local file changes


$ svn revert


To revert all the local changes in the current working copy

$ svn revert --recursive .


Creating a new branch


$ svn copy https://svn.path/project/trunk https://svn.path/project/branches/branch_name


To find the revision when the branch was created :


$ svn log --verbose --stop-on-copy


Common merge up and merge down steps


To take the merge up from trunk to your branch:


$ cd /to/your/branch


$ svn merge -r:HEAD --dry-run https://svn.path/project/trunk


* --dry-run switch will show the actual changes to be made in the repository. Remove this switch to make the actual changes.


Fix the conflicts and commit your changes


To merge down the changes from your branch to trunk


$ cd /to/trunk/directory


$ svn merge --dry-run --reintegrate https://svn.path/project/branches/branch_name


* --reintegrate will ensure no properties modifications/conflicts will go into trunk.




No comments: