SVN Intro – Branching & Merging

We will create the SVN REPO using the

  • #svnadmin create   – @SVN Server

Now create 3 directory called Trunk, Branches, Tags

The working code is initially placed in the TRUNK dir

  • #vim
  • abc 123
  • #svnserve -d

[Note: now a user abc with password 123 is created.]


  • #telnet 3690
  • #svn co svn:// #cd #mkdir trunk branches tags
  • #svn add * #svn commit -m “Added  branch tags trunk”
  • #svn import ../repo/common/dbbackup svn:// -m “Adding Code to Trunk”
  • #svn cp svn:// svn:// -m “Giving Code to Developer sanoob”
  • #svn cp svn:// svn:// -m “Giving Code to Developer Ammukutty”
  • #svn cp svn:// svn:// -m “Placing Code on Production”

@Sanoob’s Machine

  • #svn co svn://
Creating a New File (Hi.txt), modifying and Commiting it.
  • #echo Hiiiiiiiiiiiiiii > Hi.txt
  • #svn add Hi.txt
  • #svn ci -m “Deleted all and added Hi”

[NOTE: After editing a file an “SVN CI” has to be made to reflect the same on the Central Repo]

  • #svn status         – to know the added,modified or deleted status – Mostly applied to Dev Machines #echo rev2 unni > Hi.txt
  • #svn ci -m “changes to Hi.txt”

On a different machine where the checkout is already done then , the following command will update the status.

  • #svn up Hi.txt   – restore the status to a revision number latest in according to svn repo @ svn server

[NOTE: “SVN INFO” will show an updated Revision Number only if “SVN UP” is done]

To revert to a revision

  • #svp up -r 7             – Mass Updating


  • #svp up [filename] -r 7  – Only one file is Updated

@Ammukutty’s Machine

  • #svn co svn://

@Production Server – always use “SVN UP”…….and never “SVN CO”

To DELETE a file both locally & repo simultaneously –  @ PRODUCTION SERVER

  • #svn delete testdir
  • #svn ci -m “Deleted testdir “

SVN Merging – @Sanoob (NOT applicable to merge multiple developers code)

  • #svn switch svn://
  • #svn up
  • #svn merge svn:// svn://
  • #svn ci -m “Merged Production with sanoob”

SVN Merging – @Production

  • #svn merge -r<NO1.>:<NO2.> path/of/developers/trunk


NO1. – revision number of current project – PRODUCTIONS – “Last Changed Revision”
NO2. – revision number of developer project – “Last Change Revision”

More Info

SVN Directory Structure
/trunk – Development sandbox for standard scenarios
/branches – Long Isolated work; Major Structural Changes
/tags – Stable, Numbered Versions Ready for Release

SVN Status –
!  – a file is deleted locally when compared to SVN Repo
A – a file is added to SVN Repo
U – a file is updated
C – a file conflict


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s