Re: [RFC] Reverting individual files to HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Matthieu Moy <Matthieu.Moy@xxxxxxx> writes:
>
>>>> But since "git reset" already accepts partial resets in some
>>>> circumstances, I think it makes sense to slightly extend it to allow
>>>> partial reset in the case of "git reset --hard HEAD".
>>>
>>> But how would you explain "git reset --hard HEAD~24 paths"?
>>> Does it move HEAD or not (rhetorical: it shouldn't)?
>>
>> Read carrefully the very last line of the citation above your
>> questions.
>
> Yeah, I read it, and I think your point is that you want to
> special case only "--hard" and "HEAD" case.

Yes, that's what I read from my initial message:

,----
| I'd rather avoid adding yet-another-command, but I think
| "git reset --hard" could be make to accept partial revert in case it
| reverts to the HEAD (I understand it cannot otherwise, since the whole
| tree has to point to the same HEAD).
`----

I believe my wording was rather clear.

Perhaps you could have answered my point, not another one. That would
have saved time for both of us.

> I did not agree that it would be a wise thing to do.

I don't think allowing "git reset --hard HEAD file" would really mean
special-case it. I think the special case is git reset with individual
files and a revision which isn't HEAD. *That* is a special case,
because then, you can't have a sane semantics, and git dies with an
error message because it can't do better.

          whole tree     individual files
        +-------------+-------------------+
HEAD    | OK          | not OK today      |
        +-------------+-------------------+
other   | OK          | can hardly be OK  |
        +-------------+-------------------+

The case of HEAD is actually already special-cased, since it is the
default. I can write "git reset --hard". In this command, I obviously
don't want to move the HEAD, so why the hell should git refuse
"git reset --hard -- file1 file2"?

--
Matthieu
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux