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 11, 2007, 19:29 UTC
Message-ID
<20070711192959.GB3069@efreet.light.src>
In-Reply-To
<20070710143614.GA29681@piper.oerlikon.madduck.net>
On Tue, Jul 10, 2007 at 16:36:14 +0200, martin f krafft wrote:
>   git checkout origin/vim
>     Note: moving to "origin/vim" which isn't a local branch

There is more to that message, no? However, it only says "Head is now at <commit-id>", which does not really indicate, that the HEAD has been "detached". This means that it now contains a commit-id rather than name of some branch.

Git detaches head whenever you check out, without -b option, anything other than branch (without it's refs/heads prefix). If you than check out a branch, you can't see the commit on any branch anymore. However, you can still access it in reflog, ie. via expressions like HEAD@{1} or HEAD@{1 hour ago}.

You should also be able to:
 git push origin HEAD:vim

after the commit, and even (I didn't try it, but documentation seems to claim it should work):

 git push origin HEAD@{1}:vim
if you already changed HEAD more.
You can see this "metahistory" of HEAD via:
 git reflog
which is shorthand for git reflog show HEAD
-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
Previous: Jan Hudec
Message 10 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.