如何从当前工作树中删除未追踪的本地文件?
当前回答
git add --all, git stash and git stash drop, try these three commands in this order in order to remove all untracked files. 通过添加所有这些未追踪的文件到 git 并 stashing 它们将移动所有这些未追踪的文件到 stash 列表并下载顶部一个,即, stash@{0} 将从 stash 列表中删除所有未追踪的文件。
其他回答
我认为最安全、最容易的方式就是这样!
git add .
git stash
更多信息 https://www.atlassian.com/git/tutorials/saving-changes/git-stash#stashing-your-work
git clean -f
将从当前 git 中删除未追踪的文件
git clean -fd
当您要删除目录和文件时,此只会删除未追踪的目录和文件。
清除 git 存储库和所有子模块重复 以下命令将清除当前 git 存储库和所有子模块重复: (git clean -d -x -f& git submodule foreach --recursive git clean -d -x -f)
git clean -f 从工作目录中删除未追踪的文件。
我在我的博客中包含了一些基本内容, git-intro-basic-commands
正常的 git 清洁命令不会用我的 git 版本 2.9.0.windows.1 删除未追踪的文件。
$ git clean -fdx # doesn't remove untracked files
$ git clean -fdx * # Append star then it works!
推荐文章
- 如何点Go模块的依赖在Go。Mod到回购中的最新提交?
- 为什么调用git分支——unset-upstream来修复?
- Windows git“警告:LF将被CRLF取代”,这是警告尾巴向后吗?
- git中的哈希冲突
- git可以自动在空格和制表符之间切换吗?
- Git暂存文件列表
- 如何将git配置存储为存储库的一部分?
- 如何修改GitHub拉请求?
- 如何在Github和本地删除最后n次提交?
- 我如何调试git/git-shell相关的问题?
- 错误:无法使用rebase进行拉取:您有未分阶段的更改
- Git隐藏未缓存:如何把所有未分期的变化?
- 真实的恶魔
- 如何从另一个分支获得更改
- Git:权限被拒绝(publickey)致命-无法从远程存储库读取。克隆Git存储库时