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

Re: Individual file snapshots

From
Brian Gernhardt <benji@silverinsanity.com>
Date
Feb 12, 2010, 21:37 UTC
Message-ID
<12B5BDAB-DD9C-4CED-9489-0773BF577DF3@silverinsanity.com>
In-Reply-To
<ron1-519083.13253112022010@news.gmane.org>
On Feb 12, 2010, at 4:25 PM, Ron Garret wrote:
Show 12 quoted lines
> Yeah, I considered that.  The problem with that is that the actual 
> process turns out to be pretty obtrusive.  The scenario is that I've 
> done a bunch of hacking on the main branch and I realize that it's going 
> nowhere.  Nothing is working, everything is a horrible mess that's 
> spinning wildly out of control.  I want to get rid of everything I've 
> done and start over from an earlier snapshot that I knew was working.  
> But I also want to keep a copy of this current messy state around for 
> reference just in case there's a snippet here and there that might be 
> salvageable later on.  I don't know of any easy way to save the messed 
> up file onto another branch.  I'd have to save the file somewhere (in 
> the stash maybe?), check out the snapshot branch, retrieve the saved 
> file, do the commit, and then switch back to the main branch.
Have you tried creating a new branch without saving the state?

git checkout -b failed-experiment git commit -a -m "Back to the drawing board" git checkout master

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.
~~ Brian
Previous: Ron GarretNext: Ron Garret
Message 6 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.