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

[PATCH 3/6] Improve error message for branching an existing branch

From
John Tapsell <johnflux@gmail.com>
Date
Feb 19, 2009, 07:36 UTC
Message-ID
<200902190736.24402.johnflux@gmail.com>
Signed-off-by: John Tapsell <johnflux@gmail.com>
---
 branch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/branch.c b/branch.c
index 1f00e44..86ac293 100644
--- a/branch.c
+++ b/branch.c
@@ -120,7 +120,8 @@ void create_branch(const char *head,
 
 	if (resolve_ref(ref.buf, sha1, 1, NULL)) {
 		if (!force)
-			die("A branch named '%s' already exists.", name);
+			die("A branch named '%s' already exists.\n"
+			    "Maybe you wanted to change to this branch with: git checkout '%s'", name, name);
 		else if (!is_bare_repository() && !strcmp(head, name))
 			die("Cannot force update the current branch.");
 		forcing = 1;
-- 
1.6.2.rc1.3.g7d31b.dirty
Message 1 of 1 in “Improve error message for branching an existing branch”
  1. 3/6 Improve error message for branching an existing branchJohn Tapsell, Feb 19, 2009

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.