我错误地使用命令"git add dir“添加了文件。我还没有运行"git commit“。有没有办法从提交中删除这个目录和其中包含的所有内容?
我试过git reset dir,但它不起作用。显然,git reset file是撤销它的方法。但是我的文件太多了,时间太少了。
git reset dir
git reset file
发布于 2011-01-09 20:28:16
使用find和xargs
find
xargs
find dir -type f | xargs git reset
发布于 2019-12-21 13:45:42
删除尚未提交的暂存文件/文件夹的一个简单命令是- git restore --staged <dir>。
git restore --staged <dir>
https://stackoverflow.com/questions/4639091
相似问题