Git checkout / pull不会删除目录? [英] Git checkout/pull doesn't remove directories?
问题描述
我有我的回购@ github。我在家里做了一些工作,并把它推到github上。它涉及一些文件和目录的删除。现在我在我的工作箱上,它删除了文件和目录之前有一个代码副本。
我发布了以下内容:
git remote update
git checkout HEAD
git pull origin HEAD
它删除了它应该有的所有文件,但没有删除文件所在的目录。
两个问题:
- 为什么不删除目录?
- 有没有可以发布的git命令在当前状态下删除它们?
Git不会跟踪目录,所以它将不会删除因合并或其他更改而变空的内容。但是,您可以使用 git clean -fd
删除未跟踪的目录( -fd
标志表示 f orce删除未跟踪的文件和 d 目录)。
I've got my repo @ github. I did some work at home and pushed it to github. It involved some deleting of files and directories. Now I'm on my work box, which had a copy of the code before deleting the files and directories.
I issued the following:
git remote update
git checkout HEAD
git pull origin HEAD
It deleted all of the files it should have, but not the directories the files were in.
Two questions:
- Why did it not remove the directories?
- Is there a git command I can issue in the current state to remove them?
Git doesn't track directories, so it won't remove ones that become empty as a result of a merge or other change. However, you can use git clean -fd
to remove untracked directories (the -fd
flag means force removal of untracked files and directories).
这篇关于Git checkout / pull不会删除目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!