So I'm using git and interacting with an svn repo.
I have a svn TRUNK that looks like this:
A-B-C-D
And a svn bug_fixes branch that branches off at commit B or C:
-c-d-e-f-g-h-i
Now I need to get the cdefghi commits that are in my svn branch back into the master branch.
I'm aware that I could just do a squashed commit, let's call it squash SQUASH (which would contain cdefghi), but then it seems like I would have to kill the bug_fixes branch and start a new branch to cleanly continue.
Here: http://blog.red-bean.com/sussman/?p=92 they suggest:
checkout
the branch.
merge
master's changes into the branch.
Checkout
the master.
merge --reintegrate
the branch's changes onto master.
Continue development.
Unfortunately, git-svn doesn't seem to recognize any "merge --reintegrate" command for svn.
So how do I cleanly make branch and master have all commits, so that development on both can continue, using git-svn's commands?
To merge a range of revisions, use svn merge -r start:end from to where start and end are revision IDs. This will merge all revisions starting at start+1 up to and INCLUDING end . Note: it will NOT include the first revision (ex: -r3:45 will merge 4 through 45).
This basic syntax— svn merge URL —tells Subversion to merge all changes which have not been previously merged from the URL to the current working directory (which is typically the root of your working copy).
The Caveats section of the git-svn
documentation warns
For the sake of simplicity and interoperating with a less-capable system (SVN), it is recommended that all
git svn
usersclone
,fetch
anddcommit
directly from the SVN server, and avoid allgit clone
/pull
/merge
/push
operations between git repositories and branches.
The author does provide a recommendation:
The recommended method of exchanging code between git branches and users is
git format-patch
andgit am
, or justdcommit
ing to the SVN repository.
Adapting to your situation
git format-patch --stdout c^..i >my.patch
git reset --hard trunk
git am <my.patch
where c
and i
are appropriate identifiers for the commits in your history.
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