Re: [PATCH] add commit --interactive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <junkio@xxxxxxx> 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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]