From 15a147e61898d25ec8b539190e87f3a09592c9c8 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 9 Feb 2011 20:54:02 -0500 Subject: rebase: use @{upstream} if no upstream specified 'git rebase' without arguments is currently not supported. Make it default to 'git rebase @{upstream}'. That is also what 'git pull [--rebase]' defaults to, so it only makes sense that 'git rebase' defaults to the same thing. Defaulting to @{upstream} will make it possible to run e.g. 'git rebase -i' without arguments, which is probably a quite common use case. It also improves the scenario where you have multiple branches that rebase against a remote-tracking branch, where you currently have to choose between the extra network delay of 'git pull' or the slightly awkward keys to enter 'git rebase @{u}'. The error reporting when no upstream is configured for the current branch or when no branch is checked out is reused from git-pull.sh. A function is extracted into git-parse-remote.sh for this purpose. Helped-by: Yann Dirson Helped-by: Jonathan Nieder Signed-off-by: Martin von Zweigbergk Signed-off-by: Junio C Hamano --- Documentation/config.txt | 2 +- Documentation/git-rebase.txt | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'Documentation') diff --git a/Documentation/config.txt b/Documentation/config.txt index c5e183516a..b4e65b8151 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -646,7 +646,7 @@ branch..remote:: branch..merge:: Defines, together with branch..remote, the upstream branch - for the given branch. It tells 'git fetch'/'git pull' which + for the given branch. It tells 'git fetch'/'git pull'/'git rebase' which branch to merge and can also affect 'git push' (see push.default). When in branch , it tells 'git fetch' the default refspec to be marked for merging in FETCH_HEAD. The value is diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 96680c8456..d3e998df46 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'git rebase' [-i | --interactive] [options] [--onto ] - [] + [] [] 'git rebase' [-i | --interactive] [options] --onto --root [] @@ -21,6 +21,12 @@ If is specified, 'git rebase' will perform an automatic `git checkout ` before doing anything else. Otherwise it remains on the current branch. +If is not specified, the upstream configured in +branch..remote and branch..merge options will be used; see +linkgit:git-config[1] for details. If you are currently not on any +branch or if the current branch does not have a configured upstream, +the rebase will abort. + All changes made by commits in the current branch but that are not in are saved to a temporary area. This is the same set of commits that would be shown by `git log ..HEAD` (or @@ -216,7 +222,8 @@ leave out at most one of A and B, in which case it defaults to HEAD. :: Upstream branch to compare against. May be any valid commit, - not just an existing branch name. + not just an existing branch name. Defaults to the configured + upstream for the current branch. :: Working branch; defaults to HEAD. -- cgit v1.2.3