git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why not git reset --hard <path>?
@ 2015-09-28 20:34 George Spelvin
  2015-09-28 20:42 ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: George Spelvin @ 2015-09-28 20:34 UTC (permalink / raw)
  To: git; +Cc: linux

I was applying an old forgotten stash to see if there were any edits in
it I wanted to preserve, and my old changes to one file made no sense
any more.  I wanted to drop then all and keep the version in HEAD.

I'd been using git reset <path> after resolving conflicts, to leave
the changes in the same un-staged state they were before the stash,
so I tried using "git reset --hard crypto/842.c" to throw away
my local changes.

And I got
fatal: Cannot do hard reset with paths.

So I did "git reset <path>" followed by "git checkout <path>", which
achieved what I wanted.

But what I don't understand is why git reset couldn't do it for me in one
step.

I understand that "git reset --soft" makes no sense with a path, but
why not --hard?

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-09-29 19:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 20:34 Why not git reset --hard <path>? George Spelvin
2015-09-28 20:42 ` Junio C Hamano
2015-09-28 20:53   ` Jacob Keller
2015-09-28 21:19     ` Junio C Hamano
2015-09-28 21:36       ` Theodore Ts'o
2015-09-29  7:06       ` Jacob Keller
2015-09-29 16:15       ` George Spelvin
2015-09-29 19:40     ` Philip Oakley
2015-09-28 22:36   ` George Spelvin
2015-09-28 22:58     ` Junio C Hamano
2015-09-28 23:52       ` George Spelvin

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).