From: Steven Rostedt <rostedt@goodmis.org>
To: "D. Ben Knoble" <ben.knoble@gmail.com>
Cc: Mirko Faina <mroik@delayed.space>, git@vger.kernel.org
Subject: Re: Prevent git reset --hard from losing data
Date: Mon, 30 Nov 2026 12:20:22 -0500 [thread overview]
Message-ID: <20261130122022.03eea291@gandalf.local.home> (raw)
In-Reply-To: <20261130121137.2fbafcef@gandalf.local.home>
On Mon, 30 Nov 2026 12:11:37 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:
> > Here a simple "git restore ." would restore the working tree to match
> > the index (which should be equivalent to HEAD), right?
>
> Hmm, I actually wasn't familiar with the restore option. Thanks!
Hmm, the "git restore ." still leaves all the different files that were in
the current change there. That is:
$ git checkout v7.4-rc4
$ git reset v7.3.6
$ git restore .
$ git status
Not currently on any branch.
Untracked files:
(use "git add <file>..." to include in what will be committed)
AGENTS.md
Documentation/ABI/removed/sysfs-driver-uniwill-laptop
Documentation/ABI/testing/debugfs-iio-ad9910
Documentation/ABI/testing/sysfs-bus-iio-adc
Documentation/ABI/testing/sysfs-bus-iio-frequency-ad9910
Documentation/ABI/testing/sysfs-bus-mhi-devices-loopback
Documentation/ABI/testing/sysfs-driver-intel-xe-gpu
Documentation/ABI/testing/sysfs-driver-lenovo-yoga-slim7x-gen11-ec
Documentation/ABI/testing/sysfs-firmware-cca
Documentation/crypto/libcrypto-zeroization.rst
Documentation/devicetree/bindings/arm/ti/ti,omap-mpu.yaml
Documentation/devicetree/bindings/bus/hisilicon,hisi-localbus.yaml
Documentation/devicetree/bindings/bus/ti,omap-ocp2scp.yaml
Documentation/devicetree/bindings/clock/anlogic,dr1v90-cru.yaml
Documentation/devicetree/bindings/clock/clock-nexus-node.yaml
Documentation/devicetree/bindings/clock/hisilicon,clocks.yaml
Documentation/devicetree/bindings/clock/hisilicon,hi6220-stub-clk.yaml
Documentation/devicetree/bindings/clock/qcom,gcc-msm8952.yaml
Documentation/devicetree/bindings/clock/qcom,hawi-gpucc.yaml
[..]
tools/testing/selftests/sched_ext/kick.c
tools/testing/selftests/sched_ext/kick_test.h
tools/testing/selftests/sched_ext/nohz_tick_test.h
tools/testing/selftests/ublk/ctrl.c
tools/testing/selftests/ublk/test_generic_18.sh
tools/testing/selftests/ublk/ublk_cancel_ready.c
tools/testing/selftests/vfio/lib/drivers/mlx5/
tools/testing/selftests/x86/sigframe_fpu_portability.c
tools/virtio/linux/device-id/
nothing added to commit but untracked files present (use "git add" to track)
$ git status | wc -l
1480
The above was performed in a newly created worktree.
-- Steve
next prev parent reply other threads:[~2026-11-30 17:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 19:54 Prevent git reset --hard from losing data Steven Rostedt
2026-11-20 21:09 ` Mirko Faina
2026-11-23 21:00 ` Steven Rostedt
2026-11-23 23:40 ` Junio C Hamano
2026-11-30 14:54 ` D. Ben Knoble
2026-11-30 17:11 ` Steven Rostedt
2026-11-30 17:20 ` Steven Rostedt [this message]
2026-11-20 22:02 ` Junio C Hamano
2026-11-20 22:15 ` Steven Rostedt
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=20261130122022.03eea291@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=mroik@delayed.space \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox