git - 撤消 GIT Stage 并恢复本地更改

标签 git visual-studio git-for-windows git-stage

我无意中从 Visual Studio 完成了 GIT Stage。有一些文件我不想提交。因此,我想撤消我的舞台操作并恢复我的本地更改。

最佳答案

相反的 Action 是

git reset -- path/to/file

它将取消暂存此文件但保留文件中的实际更改,它们现在显示为“未暂存的更改”。

您还可以添加多个以空格分隔的路径

git reset -- path/to/file some/other/path/*

核心选项(取消所有内容)非常简洁:

git reset

文档中的一些示例:
要重置单个文件,here .
要重置多个文件,there (尽管对于这个,您不需要他们的步骤(4),因为该步骤非常特定于上下文)。

关于git - 撤消 GIT Stage 并恢复本地更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64538226/

相关文章:

Git 忽略 Release 文件夹但包含特定的 Libraries\Release 文件夹

git checkout 。添加稀疏 checkout 排除的目录

visual-studio - 在 Visual Basic 6 上链接 ENUM

git merge --no-commit 在 IntelliJ IDEA 中运行时创建 merge 提交

python - 如何在 Git Bash/WinPTY 下使用 Python3 获得 REPL/箭头键功能和 Unicode 字符

git - 在 Windows 中通过 "fast-export"将 Hg 迁移到 Git

git 钩子(Hook) : ensure each merge into the master has a message also the automatic merges

git - 如何要求确认 git reset --hard?

c++ - 错误代码Visual Studio错误:c2059 strange syntax error

c# - 为什么visual studio中的extract method命令会创建静态方法?