ma-6ren">
gpt4 book ai didi

git - 通过 "git reset --hard"从丢失未提交的更改中恢复

转载 作者:IT王子 更新时间:2023-10-29 01:11:18 27 4
gpt4 key购买 nike

有什么方法可以从 git reset --hard HEAD 恢复对工作目录的未提交更改?

最佳答案

来自这个 SO 的答案

$ git reflog show

4b6cf8e (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: reset: moving to origin/master
295f07d HEAD@{1}: pull: Merge made by the 'recursive' strategy.
7c49ec7 HEAD@{2}: commit: restore dependencies to the User model
fa57f59 HEAD@{3}: commit: restore dependencies to the Profile model
3431936 HEAD@{4}: commit (amend): restore admin
033f5c0 HEAD@{5}: commit: restore admin
ecd2c1d HEAD@{6}: commit: re-enable settings app

# assuming you want to get back to 7c49ec7 (restore dependencies to the User model)

$ git reset HEAD@{2}

你又回来了! :)

关于git - 通过 "git reset --hard"从丢失未提交的更改中恢复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5788037/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com