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

Re: Advice on strategy for "temporary" commits

From
MWMark Wooding <mdw@distorted.org.uk>
Date
Mar 8, 2007, 18:02 UTC
Message-ID
<slrnev0jtg.7lh.mdw@metalzone.distorted.org.uk>
In-Reply-To
<e1dab3980703080907v58739287p18bc2797db7d209e@mail.gmail.com>
David Tweed <david.tweed@gmail.com> wrote:
Show 8 quoted lines
> a-----------a-----------a-----------a
>  \          $           $           $
>   \-t---t---t---t---t---t---t---t---t
>
> AIUI neither git-branch nor git-checkout provide
> a way to do this. (Clearly the git datastructures
> can represent this situation, I'm just not sure how
> to ask the tools to do it.)

You want the raw git-commit-tree tool. Suppose your branches are tmp and hourly (both in refs/heads). Something like this should make your hourly commit:

	commit=$(
	  echo hourly-commit |
	  git commit-tree refs/heads/tmp^{tree} -p refs/heads/hourly)
	git update-ref -m "hourly commit" refs/heads/hourly $commit

It might be that you should then start basing your temporary commits on the most recent archive, so you should also

	git update-ref -m "hourly commit" refs/heads/tmp $commit
Then what you'll end up with is something like
a-----------a-----------a-----------a
 \          $\          $\          $
  \-t---t---t \-t---t---t \-t---t---t
Does that seem sane?
-- [mdw]
Previous: David TweedNext: Jakub Narebski
Message 5 of 7 in “Advice on strategy for "temporary" commits”
  1. David TweedMar 8, 2007
  2. Alex RiesenMar 8, 2007
  3. J. Bruce FieldsMar 8, 2007
  4. David TweedMar 8, 2007
  5. Mark WoodingMar 8, 2007
  6. Jakub NarebskiMar 9, 2007
  7. David TweedMar 11, 2007

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.