Skip to content

Commit

Permalink
git-svn: support rebase --preserve-merges
Browse files Browse the repository at this point in the history
When git svn rebase is performed after an unpushed merge, the
rebase operation follows both parents and replays both the user's
local commits and those from the merged branch. This is usually
not the intended behavior.
This patch adds support for the --preserve-merges/-p flag which
allows for a better workflow by re-applying merge commits as merges.

[ew: fixed a minor syntax error]

Signed-off-by: Avishay Lavie <[email protected]>
Signed-off-by: Eric Wong <[email protected]>
  • Loading branch information
avish authored and Eric Wong committed May 17, 2012
1 parent 6a4a482 commit b64e1f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Documentation/git-svn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,8 @@ config key: svn.repackflags
--merge::
-s<strategy>::
--strategy=<strategy>::
-p::
--preserve-merges::
These are only used with the 'dcommit' and 'rebase' commands.
+
Passed directly to 'git rebase' when using 'dcommit' if a
Expand Down
4 changes: 3 additions & 1 deletion git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ BEGIN
$_message, $_file, $_branch_dest,
$_template, $_shared,
$_version, $_fetch_all, $_no_rebase, $_fetch_parent,
$_merge, $_strategy, $_dry_run, $_local,
$_merge, $_strategy, $_preserve_merges, $_dry_run, $_local,
$_prefix, $_no_checkout, $_url, $_verbose,
$_git_format, $_commit_url, $_tag, $_merge_info, $_interactive);
$Git::SVN::_follow_parent = 1;
Expand Down Expand Up @@ -255,6 +255,7 @@ BEGIN
'local|l' => \$_local,
'fetch-all|all' => \$_fetch_all,
'dry-run|n' => \$_dry_run,
'preserve-merges|p' => \$_preserve_merges,
%fc_opts } ],
'commit-diff' => [ \&cmd_commit_diff,
'Commit a diff between two trees',
Expand Down Expand Up @@ -1592,6 +1593,7 @@ sub rebase_cmd {
push @cmd, '-v' if $_verbose;
push @cmd, qw/--merge/ if $_merge;
push @cmd, "--strategy=$_strategy" if $_strategy;
push @cmd, "--preserve-merges" if $_preserve_merges;
@cmd;
}

Expand Down

0 comments on commit b64e1f5

Please sign in to comment.