Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN: Move pending changes to a new branch

Tags:

Source code has local modifications that must not be committed to the trunk, but rather to a branch that does not yet exist.

This is what svn info shows:

Pfad: . URL: svn://10.8.0.1/fx_dev Basis des Projektarchivs: svn://10.8.0.1/fx_dev UUID des Projektarchivs: 6279aca8-1485-11de-bcb4-29f147300bdb Revision: 859 Knotentyp: Verzeichnis Plan: normal Letzter Autor: andy_svn Letzte geänderte Rev: 859 Letztes Änderungsdatum: 2010-12-02 15:08:11 +0100 (Do, 02. Dez 2010) 

(It's German, but I guess you still understand it)

How can I create a branch and move the pending changes onto that branch?

like image 810
eWolf Avatar asked Dec 03 '10 14:12

eWolf


People also ask

How do I commit a change to a new branch in SVN?

In order to do that, you only need to follow three steps: Create a new branch in which you will commit your changes. Switch your current working copy to this new branch. Commit your changes to the new branch.

How do I change branch in TortoiseSVN?

Again select the top level folder of your project and use TortoiseSVN → Switch... from the context menu. In the next dialog enter the URL of the branch you just created. Select the Head Revision radio button and click on OK. Your working copy is switched to the new branch/tag.

How do I stash changes in SVN?

Stashing Changes with SVN: Usage Called from within an SVN repo's root without arguments, svnstash first checks for an existing stash and will accordingly either propose to unstash it or to create a new one. For stashing, each diff of a modified file is shown and can be excluded or accepted.


2 Answers

Create a branch via

svn copy URL/trunk URL/branches/B_NAME -m"- New Branch" 

make an

svn switch URL/branches/B_NAME 

and then commit your changes.

This works because the copy happens on the server, not the client. The svn switch command will not overwrite changes locally when switching over to the new branch.

like image 145
khmarbaise Avatar answered Oct 31 '22 18:10

khmarbaise


Pretty much everything you ever need to know about SVN is in the red book (linked). Unless you have a specific question, maybe saying what you have tried already, it is what you should refer to.

Create a branch

http://svnbook.red-bean.com/en/1.1/ch04s02.html#svn-ch-4-sect-2.1

the svn switch command

http://svnbook.red-bean.com/en/1.0/re27.html

like image 44
Guy Avatar answered Oct 31 '22 20:10

Guy