From 31693ebf3e7cfb3e691a4ef22e8cdeda6b3146d9 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 200eb22260..2f626dc0e1 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -104,7 +104,7 @@ Options related to merging include::merge-options.txt[] -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 0a5aa2c821..a482d91a90 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 b29f2150a03b12f4256a48586735545ab41d6523 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 c26a7c8469..ce8497bf45 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -769,6 +769,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 11cce70912ba241b9978eca0ed919e4179e91491 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index b3ab4cf8f6..c30ad0c168 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -243,7 +243,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; @@ -305,6 +305,8 @@ static int config_read_branches(const char *key, const char *value, void *cb) info->rebase = v; else if (!strcmp(value, "preserve")) info->rebase = 1; + else if (!strcmp(value, "interactive")) + info->rebase = INTERACTIVE_REBASE; } } return 0; @@ -990,7 +992,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);