git add后回滚
时间: 2023-09-02 07:05:31 浏览: 193
在使用git add命令将文件添加到暂存区后,如果需要回滚,可以使用git reset HEAD <file_name>命令来撤销暂存区的内容。这将把文件从暂存区移除,但保留工作区的修改。然后可以使用git checkout -- <file_name>命令来清空工作区的修改,将文件恢复到最近一次提交的状态。这样就可以实现git add后的回滚操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [git-rollback:轻松回滚提交](https://download.csdn.net/download/weixin_42144707/18166760)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [git add . 之后 想执行回滚操作(git add 到本地仓库的代码回滚到没有add 之前的操作)](https://blog.csdn.net/qq_33210042/article/details/113684143)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [git代码回滚](https://blog.csdn.net/weixin_45069761/article/details/120792597)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文