Code

rebase: give a better error message for bogus branch
authorJeff King <peff@peff.net>
Thu, 27 Jan 2011 00:27:11 +0000 (19:27 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Jan 2011 01:27:02 +0000 (17:27 -0800)
When you give a non-existent branch to git-rebase, it spits
out the usage. This can be confusing, since you may
understand the usage just fine, but simply have made a
mistake in the branch name.

Before:

  $ git rebase origin bogus
  Usage: git rebase ...

After:

  $ git rebase origin bogus
  fatal: no such branch: bogus
  Usage: git rebase ...

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase.sh

index 1f42fb75e74fde6e7fba8b7694b227700417c0c3..26d5197a0fb627eb6991910c229eacbf9b190638 100755 (executable)
@@ -491,6 +491,7 @@ case "$#" in
        then
                head_name="detached HEAD"
        else
+               echo >&2 "fatal: no such branch: $1"
                usage
        fi
        ;;