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

Re: About detached heads

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 14, 2008, 19:11 UTC
Message-ID
<m34pb9xgrp.fsf@localhost.localdomain>
In-Reply-To
<alpine.LFD.1.00.0803141150070.3557@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 29 quoted lines
> On Fri, 14 Mar 2008, Bjorn Steinbrink wrote:
>> On 2008.03.14 10:53:25 -0700, Linus Torvalds wrote:
>>> 
>>> So the "core git" way to do it is to literally just do
>>> 
>>> 	git read-tree -u -m 3
>>> 	git commit
>>> 
>>> (or use "--reset" instead of "-m" if you want to do it even in the 
>>> presense unmerged entries).
>>> 
>> 
>> Hm, that's just squashing revert commit. Squashing can be done via:
>> git reset --soft HEAD~5    # Or wherever your squashed commit should start
>> git commit -m "Squashed from HEAD~5 onwards"
>> 
>> Now the "revert" version of that:
>> git reset --hard HEAD~5      # Go back to the state that we want
>> git reset --soft ORIG_HEAD   # Move HEAD back, but keep the index as is
>> git commit -m "Back at the state of HEAD~5"
>> 
>> AFAICT that should have the same advantages as using read-tree, but
>> doesn't feel so low-level :-)
> 
> Umm. The low-level one is a *lot* easier to understand than your 
> "high-level" one, wouldn't you say?
> 
> And when the low-level plumbing commands are easier, are they not then 
> better porcelain?
AFAIK the porcelain equivalent to plumbing
  git read-tree -u -m 3
is just
  git checkout 3 -- .
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Linus TorvaldsNext: Sean
Message 17 of 22 in “About detached heads”
  1. Geoff RussellMar 14, 2008
  2. Jonathan del StrotherMar 14, 2008
  3. David KågedalMar 14, 2008
  4. Wincent ColaiutaMar 14, 2008
  5. Matthieu MoyMar 14, 2008
  6. Wincent ColaiutaMar 14, 2008
  7. Jakub NarebskiMar 14, 2008
  8. Sergei OrganovMar 14, 2008
  9. Adam PiatyszekMar 14, 2008
  10. Chris ShoemakerMar 14, 2008
  11. Rafael Garcia-SuarezMar 14, 2008
  12. Nicolas PitreMar 14, 2008
  13. Jakub NarebskiMar 14, 2008
  14. Linus TorvaldsMar 14, 2008
  15. Björn SteinbrinkMar 14, 2008
  16. Linus TorvaldsMar 14, 2008
  17. Jakub NarebskiMar 14, 2008
  18. SeanMar 14, 2008
  19. Geoff RussellMar 14, 2008
  20. Jakub NarebskiMar 15, 2008
  21. Nicolas PitreMar 15, 2008
  22. Geoff RussellMar 15, 2008

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.