Skip to content

Instantly share code, notes, and snippets.

@ahaubold
Last active December 3, 2019 13:53
Show Gist options
  • Save ahaubold/f896c1a3aacdd7b9dbf7a0cad52be793 to your computer and use it in GitHub Desktop.
Save ahaubold/f896c1a3aacdd7b9dbf7a0cad52be793 to your computer and use it in GitHub Desktop.
SVN Basics
###########
### SVN ###
###########
################
# often needed #
################
# checkout a local svn repo
svn checkout file:///home/user/svn/project/trunk .
# if we have svn on a domain
svn checkout http://svn.domain.de/svn/testproject/trunk .
# On which branch/tag/revision are we?
svn info
# What are my changes?
svn status
#########################
# working with a branch #
#########################
svn copy http://svn.domain.de/svn/testproject/trunk http://svn.domain.de/svn/testproject/branches/new-feature
svn switch http://svn.domain.de/svn/testproject/branches/new-feature
# develop and test here
# commit feature/changes into branch
svn commit
# merge some changes from trunk into local working copy
svn merge http://svn.domain.de/svn/test/trunk .
# commit merged changes
svn commit
# reintegrate branch into trunk
# first: switch back to trunk
svn switch http://svn.domain.de/svn/testproject/trunk
# second: get the changes into working copy
svn merge --reintegrate http://svn.domain.de/svn/testproject/branches/new-feature
# third: commit merged changes from WC to svn trunk
svn commit
# create a tag for our new feature
svn copy http://svn.domain.de/svn/testproject/trunk http://svn.domain.de/svn/testproject/tags/1.1.0
# now we go to our live system and checkout the new tag
svn checkout http://svn.domain.de/svn/testproject/tags/1.1.0
# remove the old branch now
svn remove http://svn.domain.de/svn/testproject/branches/new-feature
#############
# Externals #
#############
# update the external repositories in path_of_externals/
cd path_of_externals/
svn propedit svn:externals .
# commit only svn:externals to rep
cd ..
svn commit path_of_externals/ --depth=empty
#####################
# resolve conflicts #
#####################
# @see http://svnbook.red-bean.com/de/1.5/svn.ref.svn.c.resolve.html
# normaly you use
svn resolve
# sometimes it's usefull to revert some changes
# revert a single file
svn revert PackageStates.php
# revert a single file to a revision
svn copy http://svn.domain.de/repo/path/to/file@42 .
# do a --dry-run for svn update
svn status --show-updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment