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

Re: [PATCH v2] checkout: implement "-" shortcut name for last branch

From
Thomas Rast <trast@student.ethz.ch>
Date
Jan 15, 2009, 13:59 UTC
Message-ID
<200901151500.01876.trast@student.ethz.ch>
In-Reply-To
<alpine.DEB.1.00.0901151413250.3586@pacific.mpi-cbg.de>
Johannes Schindelin wrote:
Show 7 quoted lines
> On Thu, 15 Jan 2009, Johannes Sixt wrote:
> > You must make sure that commits referenced by LAST_HEAD are not
> > garbage-collected. (I don't know if this happens anyway for symrefs in .git.)
> 
> Note: if you used reflogs for that feature, the garbage collection could 
> not have killed the commit.  However, it is quite possible that the 
> branch was deleted.
Suddenly I'm not so sure about either behaviour any more.
Consider:
  $ git commit -m initial
  [master (root-commit)]: created 812c476: "initial"
   1 files changed, 1 insertions(+), 0 deletions(-)
   create mode 100644 foo
  $ git checkout $(git rev-parse HEAD)
  Note: moving to "812c476ca23e25efa7e4d7081153ba657a127d95" 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 812c476... initial
  $ git branch -D master
  Deleted branch master (812c476).
  $ git for-each-ref
  $ git reflog expire --expire=now --all
  $ git prune --expire now
  $ git show
  fatal: bad object HEAD
  $ git show 812c476
  fatal: ambiguous argument '812c476': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions
Oops.

Some quick RTFS shows that it indeed "only" cares about refs and reflogs.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 46 in “checkout: implement "-" shortcut name for last branch”
  1. checkout: implement "-" shortcut name for last branchThomas Rast, Jan 15, 2009
  2. checkout: implement "-" shortcut name for last branchThomas Rast, Jan 15, 2009
  3. Johannes SixtJan 15, 2009
  4. Johannes SchindelinJan 15, 2009
  5. Thomas RastJan 15, 2009
  6. Johannes SchindelinJan 15, 2009
  7. Johannes SchindelinJan 15, 2009
  8. Junio C HamanoJan 15, 2009
  9. Johannes SchindelinJan 15, 2009
  10. revision walker: include a detached HEAD in --allJohannes Schindelin, Jan 16, 2009
  11. Santi BéjarJan 16, 2009
  12. Johannes SchindelinJan 16, 2009
  13. David KastrupJan 16, 2009
  14. Santi BéjarJan 16, 2009
  15. Santi BéjarJan 16, 2009
  16. Junio C HamanoJan 18, 2009
  17. Junio C HamanoJan 18, 2009
  18. Johannes SchindelinJan 18, 2009
  19. Johannes SchindelinJan 18, 2009
  20. Johan HerlandJan 15, 2009
  21. Johannes SchindelinJan 15, 2009
  22. Junio C HamanoJan 15, 2009
  23. Junio C HamanoJan 15, 2009
  24. Johannes SchindelinJan 16, 2009
  25. Johannes SchindelinJan 15, 2009
  26. Thomas RastJan 15, 2009
  27. Johannes SchindelinJan 15, 2009
  28. Thomas RastJan 15, 2009
  29. Johannes SchindelinJan 15, 2009
  30. Thomas RastJan 16, 2009
  31. Johannes SchindelinJan 16, 2009
  32. git-resurrect: find traces of a branch name and resurrect itThomas Rast, Jan 18, 2009
  33. Johannes SchindelinJan 18, 2009
  34. Thomas RastJan 20, 2009
  35. Boyd Stephen Smith Jr.Jan 20, 2009
  36. Boyd Stephen Smith Jr.Jan 20, 2009
  37. contrib git-resurrect: find traces of a branch name and resurrect itThomas Rast, Jan 23, 2009
  38. Boyd Stephen Smith Jr.Jan 23, 2009
  39. Thomas RastJan 26, 2009
  40. contrib git-resurrect: find traces of a branch name and resurrect itThomas Rast, Jan 26, 2009
  41. Junio C HamanoJan 27, 2009
  42. Thomas RastJan 30, 2009
  43. contrib git-resurrect: find traces of a branch name and resurrect itThomas Rast, Feb 1, 2009
  44. Junio C HamanoFeb 2, 2009
  45. contrib git-resurrect: find traces of a branch name and resurrect itThomas Rast, Feb 4, 2009
  46. Junio C HamanoFeb 5, 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.