All of lore.kernel.org
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Sverre Rabbelier <alturin@gmail.com>
Cc: Git Mailinglist <git@vger.kernel.org>
Subject: Re: git stash save --keep-index
Date: Tue, 15 Jul 2008 16:26:15 +0200	[thread overview]
Message-ID: <20080715142615.GI8224@neumann> (raw)
In-Reply-To: <bd6139dc0807150531k4f0a1a4yee2c8ec2b98ee39c@mail.gmail.com>

Hi Sverre,

On Tue, Jul 15, 2008 at 02:31:54PM +0200, Sverre Rabbelier wrote:
> <hack hack hack>
> $ git add # or -i / -p
> $ git stash save --keep-index
> <test if staged changes are ready to be commited>
> $ git commit
> $ git stash pop
> <lather, rinse, repeat>
> 
> But what happens if in the testing phase you detect that the commit is
> not ready yet, or even, some of the changes you staged should have
> been kept? It would make sense to 'undo' the stash the usual way:
> $ git stash pop
> But alas, it is not possible to apply on a dirty working directory, so
> one has to resort to:
> $ git commit -m "tmp"
> $ git stash pop
> $ git reset HEAD^
If there are unstaged changes in the worktree, then yes, 'git stash
apply/pop' will error out complaining about dirty state.  However, if
there are changes in the index, but no unstaged changes in the
worktree, then apply/pop should work (assuming there are no conflicts,
of course).

So, you won't need that temporary commit, if you have not modified
anything or have added all changes to the index since 'git stash
save --keep-index'.

Gábor

  reply	other threads:[~2008-07-15 14:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15 12:31 git stash save --keep-index Sverre Rabbelier
2008-07-15 14:26 ` SZEDER Gábor [this message]
2008-07-15 14:50   ` Sverre Rabbelier

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=20080715142615.GI8224@neumann \
    --to=szeder@ira.uka.de \
    --cc=alturin@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.