From 86019e264b1674c1b73f2cf5db4d17f9bfc0703d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 21 Oct 2011 23:27:09 -0500 Subject: [PATCH 1/3] Teach 'git pull' to handle --rebase=interactive Signed-off-by: Johannes Schindelin --- Documentation/git-pull.txt | 4 +++- git-pull.sh | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index 6083aab87b..353e22f795 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -104,7 +104,7 @@ include::merge-options.txt[] :git-pull: 1 -r:: ---rebase[=false|true|preserve]:: +--rebase[=false|true|preserve|interactive]:: When true, rebase the current branch on top of the upstream branch after fetching. If there is a remote-tracking branch corresponding to the upstream branch and the upstream branch @@ -117,6 +117,8 @@ locally created merge commits will not be flattened. + When false, merge the current branch into the upstream branch. + +When `interactive`, enable the interactive mode of rebase. ++ See `pull.rebase`, `branch..rebase` and `branch.autosetuprebase` in linkgit:git-config[1] if you want to make `git pull` always use `--rebase` instead of merging. diff --git a/git-pull.sh b/git-pull.sh index b946fd975b..b3b40e2fc0 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -122,6 +122,7 @@ do ;; --no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase) rebase=false + ;; --recurse-submodules) recurse_submodules=--recurse-submodules @@ -153,6 +154,10 @@ do done case "$rebase" in +i|interactive) + rebase=true + rebase_args=-i + ;; preserve) rebase=true rebase_args=--preserve-merges @@ -160,7 +165,7 @@ preserve) true|false|'') ;; *) - echo "Invalid value for --rebase, should be true, false, or preserve" + echo "Invalid value for --rebase, should be true, false, interactive or preserve" usage exit 1 ;; From 7b66e4a509735dbd73c704bd02164b889f6f2b80 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 21 Oct 2011 23:27:37 -0500 Subject: [PATCH 2/3] Handle the branch..rebase value 'interactive' Signed-off-by: Johannes Schindelin --- Documentation/config.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/config.txt b/Documentation/config.txt index ab26963d61..7e2f395aca 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -765,6 +765,7 @@ branch..rebase:: instead of merging the default branch from the default remote when "git pull" is run. See "pull.rebase" for doing this in a non branch-specific manner. + When the value is `interactive`, the rebase is run in interactive mode. + When preserve, also pass `--preserve-merges` along to 'git rebase' so that locally committed merge commits will not be flattened From c7a057458b60d358caceda81dc4ce448789e545c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 3 Feb 2012 00:12:04 -0600 Subject: [PATCH 3/3] Teach 'git remote' that the config var branch.*.rebase can be 'interactive' Signed-off-by: Johannes Schindelin --- builtin/remote.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index 4e14891095..aedeabe339 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -253,7 +253,7 @@ static int add(int argc, const char **argv) struct branch_info { char *remote_name; struct string_list merge; - int rebase; + enum { NO_REBASE, NORMAL_REBASE, INTERACTIVE_REBASE } rebase; }; static struct string_list branch_list; @@ -310,7 +310,10 @@ static int config_read_branches(const char *key, const char *value, void *cb) } string_list_append(&info->merge, xstrdup(value)); } else - info->rebase = git_config_bool(orig_key, value); + info->rebase = value && *value == 'i' ? + INTERACTIVE_REBASE : + (git_config_bool(orig_key, value) ? + NORMAL_REBASE : NO_REBASE); } return 0; } @@ -995,7 +998,9 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data) printf(" %-*s ", show_info->width, item->string); if (branch_info->rebase) { - printf_ln(_("rebases onto remote %s"), merge->items[0].string); + printf_ln(_(branch_info->rebase == INTERACTIVE_REBASE ? + "rebases interactively onto remote %s" : + "rebases onto remote %s"), merge->items[0].string); return 0; } else if (show_info->any_rebase) { printf_ln(_(" merges with remote %s"), merge->items[0].string);