Re: [PATCH] pull: add --hard mode

Junio C Hamano <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
"Artur Bieniek via GitGitGadget" <[email protected]> writes:

> From: Artur Bieniek <[email protected]>
>
> Add --hard as an explicit alternative to merge and rebase. After
> fetching, require a single integration candidate and reset the current
> branch, index, and working tree to it.

There may be a population of users who *never* make changes to their
history or working tree, and always want to "hard reset to the
updated upstream".  Doing so would be safe for them because they
create nothing in their tree whose loss matters.

Giving them a convenient and safe way to do so might be worth
considering, but the behavior is already safely and explicitly
achieved by running 'git fetch' followed by 'git reset --hard @{u}',
so I am not sure whether it is worth adding another way to do so.

More importantly, throwing it into 'git pull' feels very wrong.

The core purpose of 'git pull' is history integration.  The command
is designed to help those who make their own changes and advance
history.  Adding a destructive option to the command makes it easier
for them to trigger it by accident, and unlike the main target of
this new feature, they have things in their tree that they cannot
afford to lose to accidents or mistakes.

So, I am mildly against adding anything of this sort to 'git pull'.
For that matter, I am generally against making it convenient to
discard or destroy history.  I prefer to keep these destructive
operations explicit, e.g., "fetch + reset --hard".

Thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.