HOWTO: Subversion Copy and Merge in NetBeans



First, create a local Subversion repository to play with for this tutorial.

Create a new Java Application project in NetBeans named "HelloWorld".
Add a comment to the header of Main.java
  "This is my Hello World Project."
Save the file.

On your local file system, make directory:
    mkdir /home/username/Repositories
    cd /home/username/Repositories


Create a new subversion repository:
    svnadmin create HelloProj

Change to the directory containing your NetBeans projects:
    cd NetBeansProjects/

Import the project into the repository:
    svn import HelloWorld file:///home/jdalbey/Repositories/HelloProj/
   Provide a commit message.

Delete project and sources in NetBeans.

Now we are ready to begin the tutorial.

In NetBean, checkout the project from the repository:
From the Versioning menu, select Checkout.
Repository URL: file://home/jdalbey/Repositories/HelloProj
Click Next.
Local Folder:  /home/jdalbey/NetBeansProjects/Hello

Checkout Completed dialog appears, saying
"HelloWorld project was checked out. Do you want to open the project?"
Click Open Project.

Let's make a copy of the src folder.
Click Files tab.
Right click "src" in the file tree, choose Subversion -> Copy to.

Copy dialog appears.
Local Folder: /home/jdalbey/NetBeansProjects/Hello/src
Destination: Repository Location: Branch
Copy Description: make a branch.
Click Copy.
Verify in Versioning Output pane.

Right click on HelloWorld -> Subversion -> Update
Branch folder appears under HelloWorld.
Expand it to see subfolders.
Edit main.java and add a new line
           System.out.println("hello world");
Right-click on Main.java  select Subversion -> Commit
  Provide a commit message.

Now let's merge the changes from the branch back into the main development.
Right click "src" -> Subversion -> Merge changes

Merge From: One Repository Folder since Its Origin
Repository Folder: Branch/src

Preview shows merging  file:///home/jdalbey/Repos/HelloProj/Branch/src
into /home/jdalbey/NetBeansProjects/Hello/src

Click Merge.
Notice a blue tag appears on src and helloworld folders.

Open src/helloworld/Main.java.  It should contain the merged contents.