Git撤销修改

以 hello.txt 为例

情况一:

没有添加到暂存区的撤销方法:

用 以下命令即可撤销完成:

git checkout -- hello.txt

情况二:

添加到暂存区后的撤销方法:

1.1 先取消暂存

git reset HEAD hello.txt

1.2然后撤销修改,用命令

git checkout -- hello.txt

撤销完成。

情况三:

同步到了远程仓库:

自求多福吧。

原文地址:https://www.cnblogs.com/cypblogs/p/10015433.html