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

Re: Advice on strategy for "temporary" commits

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 9, 2007, 10:15 UTC
Message-ID
<esrbub$bg$1@sea.gmane.org>
In-Reply-To
<e1dab3980703080907v58739287p18bc2797db7d209e@mail.gmail.com>
[Cc: git@vger.kernel.org]
David Tweed wrote:
Show 5 quoted lines
> So, at this point I need to ask an embarassingly basic
> question: how do I "change branches" from T (say), in order to commit
> to a different branch A, without changing the contents of
> the working directory back to match what it was at the
> time of the last commit to A?
[...]]
Show 16 quoted lines
> So I'm on the temporary branch and have been doing
> temporary commits to it and we hit an hour mark.
> Cron wants to commit what's _currently_ in my working
> directory as a new head to the "archival branch" A
> and then swap back the temporary branch to
> commit it on that branch and carry on, ie, make
> the diagram look like:
> 
> 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.)

Try if "git checkout -m" does what you wanted. Or simply do a merge of "more often" branch into "less often" branch, perhaps simply not recording it as a merge with "git merge --squash" followed by "git commit".

By the way, you know that you can --amend a commit?
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Mark WoodingNext: David Tweed
Message 6 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.