Subject: Re: Advice on strategy for "temporary" commits

From: Jakub Narebski <[email-masked]>
Date: Fri, 09 Mar 2007 11:15:01 +0100

[Cc: [email-masked]]

David Tweed wrote:

> 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?
[...]]
> 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