From: Phillip Wood <phillip.wood123@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
Artur Bieniek via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Artur Bieniek <abieniek@antmicro.com>,
Artur Bieniek <ar2rekb@gmail.com>
Subject: Re: [PATCH] pull: add --hard mode
Date: Thu, 20 Aug 2026 10:58:56 +0100 [thread overview]
Message-ID: <0c2607e2-16da-4efd-879f-82ef2c2aa127@gmail.com> (raw)
In-Reply-To: <xmqqwltn1o4e.fsf@gitster.g>
On 18/08/2026 15:48, Junio C Hamano wrote:
> "Artur Bieniek via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
>> From: Artur Bieniek <ar2rekb@gmail.com>
>>
>> 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.
I think if the design was slightly different so that it errored out by
default if there were uncommitted changes then that would make it worth
while as it is safer than "git fetch; git reset --hard @{u}" and would
allow the user to carry over those changes with "--autostash". So to me
something like
git pull --reset [--discard-changes | --autostash]
would be a more convincing design.
> 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.
If it refused to reset by default when there were uncommitted changes
would that be safe enough? Uncommitted changes would be protected and
any local commits that become unreachable after the reset can still be
retrieved from the reflog. It's not quite the same as integrating remote
and local changes, but more like updating the working copy.
Thanks
Phillip
> 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.
>
prev parent reply other threads:[~2026-08-20 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 11:34 [PATCH] pull: add --hard mode Artur Bieniek via GitGitGadget
2026-08-18 14:48 ` Junio C Hamano
2026-08-20 9:58 ` Phillip Wood [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0c2607e2-16da-4efd-879f-82ef2c2aa127@gmail.com \
--to=phillip.wood123@gmail.com \
--cc=abieniek@antmicro.com \
--cc=ar2rekb@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=phillip.wood@dunelm.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.