Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to
- From
Boaz Harrosh <bharrosh@panasas.com>
- Date
- Jun 25, 2008, 09:12 UTC
- Message-ID
- <48620C1A.6000509@panasas.com>
- In-Reply-To
- <7vwskea2ik.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 16 quoted lines
> Steven Walter <stevenrwalter@gmail.com> writes:
>
>> @@ -225,6 +243,10 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
>> if (reset_type == HARD && is_bare_repository())
>> die("hard reset makes no sense in a bare repository");
>>
>> + if (reset_type == HARD && !force && index_is_dirty()) {
>> + die("Uncommitted changes; re-run with -f to trash them");
>> + }
>> +
>
> Please don't. With your change, does the testsuite even pass?
>
> "reset --hard" has *ALWAYS* meant to be destructive --- discarding
> potential local cruft is the whole point of the operation.
> I was under the impression that --hard means working-directory-also as opposed to tree-and-index-only. Nothing to do with destructive-discarding. If it is then something is missing. I need 2 distinct functions. You combine to functions under one command.
> Learn the lingo, and get over it. >
I did lern the lingo and got bitten. I wanted to do one thing also got the other one.
there is: git-reset --clean - destructive-discarding any local changes git-reset --hard - move tree index and working directory to new head
How can I separate between them, Please
Boaz