撤销 git reset --hard head^
时间: 2023-08-24 09:14:04 浏览: 279
delete git
要撤销 git reset --hard HEAD^ 命令,可以使用 git reflog 命令查看操作记录,找到之前的 commit_id。然后使用 git reset commit_id 回滚到对应的节点,这样就可以恢复之前的改动的代码了。\[1\]
#### 引用[.reference_title]
- *1* *3* [Git 常用撤销命令](https://blog.csdn.net/lingfengjgf/article/details/128034894)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [【git撤销操作】git reset详解](https://blog.csdn.net/qq_38987146/article/details/125149888)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文