diff --git a/Documentation/config.txt b/Documentation/config.txt index e744475059..4e1a682e89 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -775,6 +775,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 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/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); 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 ;;