git reset HEAD~12
我本想运行 ,却意外运行了get reset HEAD~1
。如何恢复刚刚重置的提交?
重置之前,大约有 8 个提交被推送到远程。其他提交仅存在于我的机器上。
为了方便起见,以下是git fsck --lost-found
dangling tree a58117938f93b1ebcdf5d10f10e2aff30b76dc31
dangling commit 15f2b2c8843a12c9fb6f39a4f4dc08351e7f4d73
dangling commit 2c8261414491eb9a9f63e2dc4231f88455945926
dangling tree 35e25b9cbeda0176625f8e34bf54ded457875ffa
dangling commit bac28f261e9cd8652c5e648ada4f0dafd11234c7
dangling tree 18735078b8bc64793d21be69bb1132d1e65673b4
dangling commit 585324a540ee921c228dcb574e1731c52add0e8e
dangling commit 94b379ab9ce29ecf41dddfb919262e148f916eca
dangling commit 14d51a03f2ea8e90497df6d59d6f5cb9502b9fa2
dangling tree 14573e776026c2baf5a87989a58d4e30c94b034e
dangling commit 15d711245b3ae84cd164f5fde15afba8410754f1
dangling tree 2c170fe363e559f70ea3dfe60b44cf7b20099a48
dangling tree 33076973ad5a9b75e280df95ea60895838337e9c
dangling commit 4df7dff300723f021257e5e08d79f5c3e13e196d
dangling tree f3c7efc967816b4a34c956615527cc7c8313e69c
dangling commit f307ed0bf520c458d41e670cd4a443e207ccff59
dangling commit 9a08d648a2c8a8c6bc0e40aa667a5dde7496bd54
dangling commit d4888fd593655d5df54ce2a821ce9ebf47911af3
dangling commit 1609b1303b5c026ee5ebe0df725bc8b6a43fb077
dangling commit b4d903f6302c85847a32e0cb35e380a6cafa789d
dangling tree ca495c16e084820401de0a3e8512635e1517580e
dangling commit 56dafd9401085a32b6480a6d4a42fd73089937ec
dangling commit 8a7a90f08702ad91665f1805cec21ccd221cbd9c
dangling commit 989a3145b5cadb8fca249f08209d751cfc2f6b2e
dangling commit fa6a6765e6edca806efd964546eb8664c82e3dbc
dangling commit 17fb737b2f7e9f0a832e779032592eaff27232b8
dangling tree 241b976dc46ed6e8722c80d87bd839fd6c7e30cd
dangling commit 37eca2e44546c42584348cdbd3f1b88e6df8b45a
dangling commit 9eace3ee8c4cb9b7dd47963dc208232fb392e7ab
dangling commit 603ee383776b11081ce4b66ece113473cd1725bd
dangling commit b5ce5547aa9151a2ad4eee017d38abacf078f172
dangling commit feeeacf0e86214302cda079d50ca78dd5aec64dd
dangling commit 030fc2e3ba6a54946e2e09ae364242c1e39dbc75
dangling commit f23f6d5e9fb3bc4b5a80c91d2628eb92efec5604
答案1
git reflog <BRANCH>
(或git reflog show <BRANCH>
)显示最近对该分支所做的更改,包括提交/变基。
如果你找到了was-HEAD^1
提交,你可以git reset
再次回到该位置。