Git-svn: create and push new branch / tag?

After cloning the SVN repository using git-svn with the -s option ( git svn clone http://server/repo -s ), how to create a branch or tag and move to the corresponding branch / tag directory in the repository when dcommit ING?

For example; if I used git to create a foobar branch locally ( git checkout -b foobar ), how can I git-svn create a branch on the server ( http://server/repo/branches/foobar )?

I am using git 1.5.5.6.




Note:

The method below does not work with git 1.5.5.6 , since there is no git svn branch method. I'm still looking for a solution for this that does not require permission to work with svn directly.

+50
git git-svn
Mar 22
source share
3 answers

You can read all the detailed details in this tutorial , but the gist is basically the following:

 $ git svn branch -m "Topic branch" my_topic # Create SVN branch called "my_topic" $ git checkout --track -b my-topic remotes/my_topic # Create the Git branch for "my_topic" # Hack hack hack... $ git svn dcommit --dry-run # Make sure you're committing to the right SVN branch $ git svn dcommit # Commit changes to "my_topic" branch in SVN 
+70
Mar 26
source share

If you created a local branch before the subversion branch exists, and now you want to direct your local branch to the subversion branch, you can do the following:

Create svn branch from revision created by your local branch

     $ svn cp http: // svn-repo / my_app / trunk @ 123 http: // svn-repo / my_app / branches / feature1

Check out the new svn branch to let your git report know about it

     $ git svn fetch

Now the svn branch should be added as remote in your git repository

     $ git branch -a
     * feature1
       master
       remotes / feature1

At this point, your remote will still be trunked. You need to point your local branch to the new remote branch. This can be done by reinstalling the local branch from the remote branch:

     $ git rebase remotes / feature1

Now that your local branch belongs to your remote branch, you can commit your changes to it. Make a dry run first to make sure your changes go to your remote branch:

     $ git svn dcommit --dry-run
     Commiting to http: // svn-repo / my_app / branches / feature1

Now you can make changes to the remote branch

     $ git svn dcommit

Most of the instructions will tell you about starting a branch subversion, and then create a local branch that tracks the remote branch. But I often don’t decide in advance whether my local branch should monitor the remote branch. Often I deploy locally and make changes without the intention of moving to a remote branch. If later I decide to transfer the local branch to the remote branch, follow these steps.

+46
Mar 23 2018-12-23T00:
source share

I just wanted to point out that you should not reinstall to your newly created branch from material that you already have in another git branch. git svn dcommit then after that clicks on the trunk, it seems. At least that was a problem for me.

Instead, if you want to pull changes from the old git branch to this new svn branch, use, for example, cherry pick.

0
Feb 24 2018-12-12T00:
source share



All Articles