# Git操作本地commit,未push到远程

有的时候不小心commit了一些不要的代码,想要撤销本地commit

本教程使用idea工具进行撤销

# 第一步 选中项目右键git-->show history

show history

# 第二步、选择需要撤回的文件 右键Select in git log

git log

# 第三步、选择需要撤回的文件右键 Undo Commit……

Undo Commit

# 第四步、选择需要回退到哪个Local Changes目录下(默认是Default Changelist)点击ok

Undo Commit

# 第五步、显示Reset successful表示已经成功撤销本地的commit

Reset successful

# 第六步、现在查看Default Changelist刚才commit的文件已经回退到本地

Default Changelist

上次更新: 2020-6-14 20:42:40