To create a branch or a tag in a Subversion repository, do the following: From the main menu, choose VCS | Subversion | Branch or Tag. Alternatively, select the source folder in the SVN Repositories tool window and choose the Branch or Tag command from the context menu.
New Branches The git branch command can be used to create a new branch. When you want to start a new feature, you create a new branch off main using git branch new_branch . Once created you can then use git checkout new_branch to switch to that branch.
Next use svn switch svn+ssh://host.example.com/repos/project/branches/NAME_OF_BRANCH . (if you want to switch current checkout to new branch) or svn checkout svn+ssh://host.example.com/repos/project/branches/NAME_OF_BRANCH (if you want to have new branch in seperate directory) to start working on newly created branch.
I know this question has been answered a while ago, but after reading it, I it might help adding examples of the specific git svn branch command and relate it to a typical workflow.
Like kch answered, use git svn branch
. Here is a full example, (note the -n
for dry-run to test):
git svn branch -n -m "Branch for authentication bug" auth_bug
If this goes well, server replies with answer like this:
Copying https://scm-server.com/svn/portal/trunk at r8914 to https://scm-server.com/svn/portal/branches/auth_bug...
And without the -n
switch the server probably adds something like:
Found possible branch point: https://scm-server.com/svn/portal/trunk => https://scm-server.com/portal/branches/auth_bug, 8914
Found branch parent: (refs/remotes/auth_bug)
d731b1fa028d30d685fe260f5bb912cbf59e1971
Following parent with do_switch
Successfully followed parent r8915 = 6ed10c57afcec62e9077fbeed74a326eaa4863b8
(refs/remotes/auth_bug)
The best part of it, now you can create a local branch based on your remote branch like so:
git checkout -b local/auth_bug auth_bug
Which means "check out and create local branch named auth_bug
and make it follow the remote branch (last parameter) auth_bug
Test that your local branch works on that remote branch by using dcommit
with --dry-run
(-n
):
git svn dcommit -n
And SVN server should reply with the new branch name:
Committing to https://scm-server.com/svn/portal/branches/auth_bug ...
as of git v1.6.1, git svn branch
is available.
From the git docs:
branch Create a branch in the SVN repository. -m, --message Allows to specify the commit message. -t, --tag Create a tag by using the tags_subdir instead of the branches_subdir specified during git svn init.
Previous versions of git do not provide a way to create an svn branch.
@kch I just (7 December 2008) compiled the v1.6.1-rc1 tag of git and it does contain the git svn branch command and the documentation for it. So the v1.6.1 release of git should (hopefully) contain this command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With