Re: Why not git reset --hard <path>?
- From
- George Spelvin <linux@horizon.com>
- Date
- Sep 28, 2015, 22:36 UTC
- Message-ID
- <20150928223607.15594.qmail@ns.horizon.com>
- In-Reply-To
- <xmqq612ucm3p.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> wrote:
> "git checkout HEAD <pathspec>" is a 99% acceptable substitute for it > (the only case where it makes a difference is when you added a path to > the index that did not exist in HEAD).
Er, wait a minute...
"git checkout <tree-ish> <pathspec>" modifies the index?
Damn, I've been using git for years and I never knew that. I thought it only modified the working tree.
But I just tested, and it does. Damn, now I have to figure out how to "leapfrog" a file from history into the working tree without overwriting the index; that's occasionally useful.