git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "David Kågedal" <davidk@lysator.liu.se>
To: git@vger.kernel.org
Subject: Re: [PATCH] add commit --interactive
Date: Fri, 02 Mar 2007 13:47:17 +0100	[thread overview]
Message-ID: <87hct3zuay.fsf@morpheus.local> (raw)
In-Reply-To: 7v649ki3h1.fsf@assigned-by-dhcp.cox.net

Junio C Hamano <junkio@cox.net> writes:

> Probably the operation would go like this.  I'll describe them
> in terms of lower level operations, and leave the scripting to
> others.
>
> * Stashing the current state

[...]

> * Switch to the commit you want to apply part of what was

[...]

> * Trickle some of the stashed changes in, perhaps interactively:

[...]

> * Review and test the change in the working tree.  This does not

[...]

> * Then this is the tricky and interesting part.  We need to
>   subtract the change we already used to advance HEAD from
>   "stashed changes".  I do not think we currently have a single
>   command to do this step, but it would probably go like this.

What I would want to do here is to simply restore the original "stash"
tree, so something like "git checkout stash -- ." would probably work.

The reason is that what I would consider a common scenario is that I
realize that some of the changes I made should be commited first, and
I extract them the way you describe, and maybe update them to erase
traces of things I don't want to commit, perhaps on the same source
lines.

But then I want to continue where I was, and reintroduce the things I
cleaned away in the previous step.

This is also much simpler to do.  So let's make two scripts
"git-stash" and "git-unstash"

    # git-stash:
    git-commit -m "temporary stash"
    git-tag stash
    git-reset --hard HEAD^

    # git-unstash:
    git-checkout stash -- .
    # or possibly:
    #current=$(git-rev-parse HEAD)
    #git-checkout stash
    #git-reset --mixed $current
    git-tag -d stash

Then I would do this:

  [ ... hack hack ... ]
  $ git stash
  $ git pick stash
  [ ... cleanup ... ]
  $ git commit -a -m "first change"
  $ git unstash

-- 
David Kågedal

      reply	other threads:[~2007-03-02 12:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-01 10:56 [PATCH] add commit --interactive Paolo Bonzini
2007-03-02  6:06 ` Junio C Hamano
2007-03-02 12:47   ` David Kågedal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hct3zuay.fsf@morpheus.local \
    --to=davidk@lysator.liu.se \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).