Re: Add porcelain command to revert a single staged file to its HEAD state while preserving its staged state
- From
Thomas Rast <trast@inf.ethz.ch>
- Date
- May 4, 2013, 08:58 UTC
- Message-ID
- <87obcryvcw.fsf@hexa.v.cablecom.net>
- In-Reply-To
- <CADeMBooSZA4D7YctRpRf+axjcUhkMBaJhkd89nssxZYFKph5sA@mail.gmail.com>
Dimitar Bonev <dsbonev@gmail.com> writes:
Show 10 quoted lines
> I have been looking for such a command/option and no one gave me > sufficient answer. So this message should be considered as a feature > request. I had a situation where I had staged a file with a problem > solution in it, then I wanted to experiment with a different solution > so I had to revert the file to its HEAD state and I couldn't find a > way that preserves the staged state of that file. More discussions: > > https://groups.google.com/forum/?fromgroups=#!topic/git-users/nYiN-rE_3i0 > > http://stackoverflow.com/questions/16335799/git-porcelain-command-to-revert-a-single-file-to-its-head-state-but-keep-its-sta
Is that a common enough issue to warrant a better solution than
git show HEAD:targetfile > targetfile
which is how we would do it?
Or more likely,
git commit -m WIP git revert -n HEAD
which is safer anyway, since it doesn't lose the formerly-staged state so easily (you have the reflog in case of any mistakes).
--
Thomas Rast
trast@{inf,student}.ethz.ch