Re: Restore a single file in the index back to HEAD

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

 



Andy Parkins <andyparkins@xxxxxxxxx> writes:

> On Wednesday 2006, November 01 18:28, Junio C Hamano wrote:
>
>> So from that point of view, the above commandline perfectly
>> makes sense.  However, giving anything but HEAD with path makes
>> us go "Huh?"  It is unclear what this should mean:
>>
>> 	git-reset [--hard | --mixed] HEAD^ oops/file1
>
> I don't understand.  Why wouldn't that mean reset oops/file1 to the state it 
> had in HEAD^?

Path limiters everywhere in git means "do this only for paths
that match this pattern, and empty path means the pattern match
every path -- the command's behaviour is not different in any
other aspect between the case you gave no limiter and the case
you gave _all_ paths as limiters".  So the other paths remain as
they were (both index and working tree), and HEAD needs to be
updated to HEAD^ in the above example.

While that perfect makes sense from mechanical point of view, I
am not sure what it _means_ to keep some paths from now
abandoned future while having some other paths reset to the
rewound commit, from the point of view of end-user operation.

In other words, I do not have a good explanation on what "git
reset [--hard|--mixed] <commit> <path>..." does that I can write
in the documentation.

Now I admit I am not the brightest in the git circle, but if I
have trouble understanding what it does, can we expect other
people to grok it?

>> On the other hand, we already have --again, so maybe we have
>> already passed the point of no return.  So I am inclined to
>> agree with your "update-index --reset" approach, unless somebody
>> else injects sanity into me.
>
> Actually; you've talked me out of it.   Given that git-reset is already 
> porcelain, and none of the solutions are screaming "right"; it seems better 
> to slightly bend git-reset than git-update-index.

Well, now I am not sure of anything anymore ;-).

-
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]