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 15, 2008, 00:03 UTC
Message-ID
<m3zlt0x39k.fsf@localhost.localdomain>
In-Reply-To
<93c3eada0803141643r2f2c4c56l9e59f2ee7b67a8ca@mail.gmail.com>
"Geoff Russell" <geoffrey.russell@gmail.com> writes:
Show 13 quoted lines
> I thought my question was trivial, but judging by the number of
> answers, clearly not!
> 
> I understand "git read-tree -u -m 3 ; git commit" and it does exactly
> what I want.
> 
> The context where I want to use this is for users who update files,
> can understand "take me back to the state I was in at 4pm yesterday
> before I mucked up my data" but who don't want to know about
> merging, branching, topics, etc, etc, But of course having taken
> them back to the 4pm commit, they then realise that they really need
> the 6pm commit or perhaps the 3pm commit. So anything which just
> throws away commits would be risky.

Thanks to the reflog even if they go the "git reset --hard 3" route, the commits would be protected for gc.reflogExpireUnreachable period, which defaults to 30 days, by reflog. After this period they could be garbage-collected.

> The "git read-tree -u -m 3; git commit" allows me to present a
> simple straight line view of the data, which is perfect for the
> people I'm dealing with.
Simple, straight line with _rewinds_, i.e. not so simple history.

Unless you can expect users to find errors later than 30 days, or you have pushed non-rewritable branch already, then "git reset --hard 3" is IMHO a beter solution than "git read-file -u -m 3 && git commit -a".

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Geoff RussellNext: Nicolas Pitre
Message 20 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.