From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: git@vger.kernel.org
Subject: git-svn merge helper
Date: Sun, 30 Sep 2007 13:05:50 +0200 [thread overview]
Message-ID: <20070930110550.GA4557@atjola.homenet> (raw)
Hi,
I recently discovered git-svn and absolutey love it. One thing that I'm
missing though, is an equivalent of "svn merge" for merging between svn
remotes, to support the SVN way of using "squashed" merges, where you
just note the merge meta-data in the commit message. "git merge" didn't
work for me (and probably isn't expected to work) to merge between two
svn branches, so I've resorted to cherry-picking the required commits
one by one into a temporary branch and then squashing them together by
doing a --squash merge with a second temporary branch (as in [1]).
Of course that becomes extremely annoying if there are like 200
commits to merge, so I came up with the following script to help me.
It does just what I described above, but automated. Usage is like this:
git-svn-merge trunk 123 543
Which does the same as "svn merge -r123:543 trunk-url", except for being
incremental (ie. no huge one-time patch, eventually causing a massive
set of conflicts) and often faster.
In case of conflicts, it bails out and let's you fix them. Then you can
just re-run it with the same parameters again, as it automatically
determines where to start cherry-picking if you're currently on the
merge branch.
It's neither complete nor nice to look at, but it more or less gets the
job done, so I thought I'll just post it here, maybe someone picks it up
and brings it into shape.
Thanks,
Björn
[1] http://cheat.errtheblog.com/s/gitsvn/
#!/bin/sh
BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
START=$(git svn find-rev r$2 $1)
END=$(git svn find-rev r$3 $1)
if echo $BRANCH | grep -q svnmerge/
then
START=$(git svn find-rev r$(git svn find-rev HEAD) $1)
else
git checkout -b svnmerge/$BRANCH
fi
for HASH in $(git log --pretty=format:%H --reverse $START..$END)
do
git cherry-pick $HASH || exit
done
git checkout $BRANCH
git checkout -b svnmerge/$BRANCH-squashed
git merge --squash svnmerge/$BRANCH
git commit -m "Merged changes from revisions $2-$3 from $1 into $BRANCH."
next reply other threads:[~2007-09-30 11:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-30 11:05 Björn Steinbrink [this message]
2007-09-30 14:15 ` git-svn merge helper Benoit SIGOURE
2007-10-01 2:50 ` Björn Steinbrink
2007-10-01 7:56 ` Benoit SIGOURE
[not found] ` <8c5c35580710010113v7d4ad14bt129b7cb12d8f4fb8@mail.gmail.com>
2007-10-02 21:14 ` Björn Steinbrink
2007-10-02 22:04 ` Steven Walter
2007-10-02 22:38 ` Björn Steinbrink
2007-10-03 0:42 ` Steven Walter
2007-10-03 1:02 ` Björn Steinbrink
2007-10-03 11:40 ` Andreas Ericsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070930110550.GA4557@atjola.homenet \
--to=b.steinbrink@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).