Creating SVN Branch on Local Repository
Solution 1
No, that's not how you create a branch. You first make a copy of the trunk in the SVN repo (the branch is this copy):
svn copy http://the.url/theProject/trunk http://the.url/theProject/branches/my_new_branch -m "created new branch"
Then either you switch your current working copy to this new branch (but you should rename the directory to something other than trunk, because it's confusing) or, if you want to have the trunk and the branch locally, you checkout the branch to another location.
Solution 2
Use this command, the message should be in single quotes.
svn copy https://example.com/svn/repo/trunk https://example.com/svn/repo/branches/new_branch -m 'creating new branch'
Solution 3
Try:
svn copy -m "creating" http://10.4.55.7/svn/repos/myproject/trunk http://10.4.55.7/svn/repos/myproject/branch/sss
Note that -m "creating"
can be placed at the end of the line.
Anthony
Do you love the Great Books of the Western Civilization? Let's start a reading group! I'm currently studying: What Every Computer Science Major Should Know Programmer's Competency Matrix Coursera edX Must reads: Don't Call Yourself a Programmer Must listens: Software Engineering Radio
Updated on June 04, 2022Comments
-
Anthony almost 2 years
I am trying to create an svn branch on a local repository on my computer. Based on my understanding of what I read in the svn book, I am supposed to first create the branch directory (using svn mkdir), then copy from my repository into my working copy's branch directory (is this correct?).
Here are the locations for my repository and working directory:
My local repository: "SVN/repo".
My working copy: "SVN_WORK_COPY/repo/trunk"
My branch destination: "SVN_WORK_COPY/repo/branches/my_code_branch"When I typed:
svn copy SVN/repo SVN_WORK_COPY/repo/branches/my_code_branch -m "Created first branch"
I got the following message:
svn: Local, non-commit operations do not take a log message or revision properties
When I typed:
svn copy SVN/repo SVN_WORK_COPY/repo/branches/my_code_branch
I got the following message:
svn: 'SVN\repo' is not a working copy
When I typed:
svn copy SVN_WORK_COPY/repo/trunk SVN_WORK_COPY/repo/branches/my_code_branch -m "First Branch"
I got this message again:
svn: Local, non-commit operations do not take a log message or revision properties
Finally, When I typed:
svn copy SVN_WORK_COPY/repo/trunk SVN_WORK_COPY/repo/branches/my_code_branch
I got:
A SVN_WORK_COPY/repo/branches/my_code_branch\trunk
and my file (code.txt) is inside this trunk directory. However, I doubt very much that I created a branch correctly because
- I was not allowed to create a message (using -m)
- I did not want the "trunk" directory in "my_code_branch" directory
- I did not see the message "Committed revision 4" (Im at revision 4 currently)
So where did I go wrong?