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

Re: pushing changes to a remote branch

From
JHJan Hudec <bulb@ucw.cz>
Date
Jul 14, 2007, 08:38 UTC
Message-ID
<20070714083843.GA3678@efreet.light.src>
In-Reply-To
<7v1wfe4op5.fsf@assigned-by-dhcp.cox.net>
On Wed, Jul 11, 2007 at 14:26:14 -0700, Junio C Hamano wrote:
Show 14 quoted lines
> Jan Hudec <bulb@ucw.cz> writes:
> 
> >>   $ git checkout origin/master
> >>   Note: moving to "origin/master" which isn't a local branch
> >>   If you want to create a new branch from this checkout, you may do so
> >>   (now or later) by using -b with the checkout command again. Example:
> >>     git checkout -b <new_branch_name>
> >>   HEAD is now at f4855d4... 1
> >
> > The problem of this warning is, that it does not actually say anything about
> > detached and that potential commit won't update the ref being checked out.
> 
> "Being detached" is a rather geekish synonym to "which isn't a
> local branch", isn't it?

In a sense, no, it is not. "Being detached" is a synonym of "HEAD is not symbolic ref". The current warning does not really convey the information, that the ref being checked out will not be updated. Maybe it could be extended along the lines of following patch.

Hm, it will say the same when checking out with commit name, which does not make sense much, though.

-->8-- Extend the detached head warning in checkout.

The warning when detaching head now explicitely states that ref being checked
out will not be updated.
---
 git-checkout.sh |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-checkout.sh b/git-checkout.sh
index 17f4392..502b2be 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -178,7 +178,8 @@ then
 	detached="$new"
 	if test -n "$oldbranch" && test -z "$quiet"
 	then
-		detach_warn="Note: moving to \"$new_name\" which isn't a local branch
+		detach_warn="Note: moving to \"$new_name\" which isn't a local branch, so it will
+_not_ be updated by local commits.
 If you want to create a new branch from this checkout, you may do so
 (now or later) by using -b with the checkout command again. Example:
   git checkout -b <new_branch_name>"
-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Previous: Junio C HamanoNext: Jan Hudec
Message 9 of 10 in “pushing changes to a remote branch”
  1. martin f krafftJul 10, 2007
  2. Jeff KingJul 10, 2007
  3. Brian GernhardtJul 10, 2007
  4. Jeff KingJul 10, 2007
  5. Sean KelleyJul 11, 2007
  6. Jan HudecJul 11, 2007
  7. Jan HudecJul 11, 2007
  8. Junio C HamanoJul 11, 2007
  9. Jan HudecJul 14, 2007
  10. Jan HudecJul 11, 2007

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.