From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: edgar.hipp@netapsys.fr
Cc: git@vger.kernel.org
Subject: Re: Proposal for git stash : add --staged option
Date: Wed, 22 Apr 2015 11:25:41 +0200 [thread overview]
Message-ID: <0082a449b4d1723cb557ac353a04c3af@www.dscho.org> (raw)
In-Reply-To: <96c00a316c79d9e5a85e199ba7d6f317@netapsys.fr>
Hi Edgar,
On 2015-04-22 10:30, edgar.hipp@netapsys.fr wrote:
> When you have a lot of unstaged files, and would like to test what
> happens if you undo some of the changes that you think are unecessary,
> you would rather keep a copy of those changes somewhere.
>
> For example
>
> Changed but not updated:
> M config_test.xml
> M config_real.xml
>
> I have changed both config_test.xml and config_real.xml, but I think
> the changes made in config_test.xml are unnecessary. However, I would
> still like to keep them somewhere in case it breaks something.
>
> In this case for example, I would like to be able to stash only the
> file config_test.xml
>
> Eg:
>
> git add config_test.xml
> git stash --staged
>
> So that after this, my git looks like this:
>
> Changed but not updated:
> M config_real.xml
>
> and my stash contains only the changes introduced in config_test.xml
>
> `git stash --keep-index` doesn't give the necessary control, because
> it will still stash everything (and create unnecessary merge
> complications if I change the files and apply the stash)
I often have the same problem. How about doing this:
```sh
git add config_real.xml
git stash -k
git reset
```
The difference between our approaches is that I keep thinking of the staging area as the place to put changes I want to *keep*, not that I want to forget for a moment.
Having said that, I am sympathetic to your cause, although I would rather have `git stash [--patch] -- [<file>...]` that would be used like `git add -p` except that the selected changes are *not* staged, but stashed instead.
Ciao,
Johannes
next prev parent reply other threads:[~2015-04-22 9:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 8:30 Proposal for git stash : add --staged option edgar.hipp
2015-04-22 9:25 ` Johannes Schindelin [this message]
2015-04-23 6:59 ` edgar.hipp
2015-06-03 13:32 ` edgar.hipp
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=0082a449b4d1723cb557ac353a04c3af@www.dscho.org \
--to=johannes.schindelin@gmx.de \
--cc=edgar.hipp@netapsys.fr \
--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).