git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] rebase: give a better error message for bogus branch

From
Jeff King <peff@peff.net>
Date
Jan 27, 2011, 00:27 UTC
Message-ID
<20110127002711.GB32711@sigill.intra.peff.net>

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>
---
 git-rebase.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 345b18c..cbb0ea9 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -482,6 +482,7 @@ case "$#" in
 	then
 		head_name="detached HEAD"
 	else
+		echo >&2 "fatal: no such branch: $1"
 		usage
 	fi
 	;;
-- 
1.7.4.rc3.5.g8354b
Next: Junio C Hamano
Message 1 of 2 in “rebase: give a better error message for bogus branch”
  1. 2/2 rebase: give a better error message for bogus branchJeff King, Jan 27, 2011
  2. Junio C HamanoJan 27, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.