How to tag SVN branch on the server from Git repository

Image the following situation:

You are using SVN on the server and to deploy on the server you have to TAG release. You are using Git on your local machine and you have following commits:

Task is to create the SVN branch from first red dot and than add the another commit marked with the black dot.

Git version

To do that in Git  is what you would expect:

reset the master to last commit that you need (red),

1: git reset --hard SHA_code

than create and switch to new branch

2,3: git checkout -b name_of_the_branch

and cherry-pick the commit/s.

4: git cherry-pick -x SHA_code

Git SVN version

Reset master to red dot

1: git reset --hard SHA_code

create and switch to new branch

2: git svn branch name_of_the_branch (this create branch on the server)
3: git checkout -b local/name_of_the_branch name_of_the_branch

and cherry-pick the commit/s.

4: git cherry-pick -x SHA_code

and push changes on the server

5: git svn dcommit

to tag this branch on svn type

6: git svn tag tag_name

Note: if you did not checkout the branch in proper way (svn way – step 2) you will tag the master branch

Leave a Reply

Your email address will not be published. Required fields are marked *