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

Re: Individual file snapshots

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2010, 22:14 UTC
Message-ID
<7v1vgqksoz.fsf@alter.siamese.dyndns.org>
In-Reply-To
<ron1-62D136.13570812022010@news.gmane.org>
Ron Garret <ron1@flownet.com> writes:
Show 14 quoted lines
>> Or if a series of commits seem to have gone bad:
>> 
>> git commit -a -m "Well, that didn't work."
>> git branch failed-experiment
>> git reset --hard origin/master # or other good state
>> 
>> You can of course replace the -a to commit with the needed "git add <file>" 
>> commands and leave off the -m to leave real messages about why it went bad 
>> using $EDITOR.
>
> That would require a separate branch for every snapshot, no?  I want 
> this to be lightweight.  It's not so much the creation of a zillion 
> branches that bothers me, but having to come up with a new name every 
> time would be a real hassle.
Perhaps "stash"?

Usually stash is used to store "diff between stash@{N}^1 and stash@{N}", and "stash pop" or "stash apply" are geared toward that usage. But you can use it as a way to keep snapshots. You would be interacting with the stash differently, though. E.g.

	git diff stash@{4}
	git diff origin/master stash@{2}
	git checkout stash -- Makefile
Previous: Ron GarretNext: Ron Garret
Message 8 of 18 in “Individual file snapshots”
  1. Ron GarretFeb 12, 2010
  2. Peter KreftingFeb 12, 2010
  3. Ron GarretFeb 12, 2010
  4. René ScharfeFeb 12, 2010
  5. Ron GarretFeb 12, 2010
  6. Brian GernhardtFeb 12, 2010
  7. Ron GarretFeb 12, 2010
  8. Junio C HamanoFeb 12, 2010
  9. Ron GarretFeb 12, 2010
  10. Brian GernhardtFeb 12, 2010
  11. Ron GarretFeb 12, 2010
  12. Mark LodatoFeb 13, 2010
  13. Junio C HamanoFeb 13, 2010
  14. Mark LodatoFeb 13, 2010
  15. Ron GarretFeb 13, 2010
  16. Junio C HamanoFeb 13, 2010
  17. Ron GarretFeb 13, 2010
  18. Larry D'AnnaFeb 13, 2010

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.