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

Error in documentation for @{-n} in gitrevisions

From
Kevin <ikke@ikke.info>
Date
Jan 11, 2014, 17:34 UTC
Message-ID
<CAO54GHBRbVQWDjE70tEZY=nP==gtrqVvmx1JWYNkc_HOeDnYDA@mail.gmail.com>

While discussing the behavior of "git checkout -", I apparently was confused because the documentation states:

  The construct @{-<n>} means the <n>th branch checked out before the
current one.

But experimenting with it, it also takes you back to previously checkout commits.

  git-checkout-at-minus-one :: (master) » git checkout origin/master
  Note: checking out 'origin/master'.
  HEAD is now at f8b2f0c... two
  git-checkout-at-minus-one :: (f8b2f0c) » git checkout -
  Switched to branch 'master'
  git-checkout-at-minus-one :: (master) » git checkout -
                                              Note: checking out
'f8b2f0c1419d1fe798159c2c2578d2dbe1323148'.
  HEAD is now at f8b2f0c... two

Either the documentation is wrong, and should be changed to "<n>th branch/commit checkout out before the current one", or the behavior of @{-1} is wrong.

Next: Ramkumar Ramachandra
Message 1 of 3 in “Error in documentation for @{-n} in gitrevisions”
  1. KevinJan 11, 2014
  2. Ramkumar RamachandraJan 12, 2014
  3. Documentation: @{-N} can refer to a commitThomas Rast, Jan 19, 2014

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.