如何完全忽略 Git 中用户生成的图像?
我是 Git 的新手。
我位于“维护”分支,我想切换回“master”,但收到错误:
error: The following untracked working tree files would be overwritten by checkout:
vault/users/1/thumb.jpg
vault/users/1/speck.jpg
vault/users/1/prof.jpg
vault/users/1/mini.jpg
vault/users/1/full.jpg
我认为这些图像被忽略,因为在我的 .gitignore 文件中,我说忽略“vault/”。事实上,在尝试提交时它们不会显示为已修改或添加等。看来忽略起作用了。
那么,当我尝试签出我的主分支时,为什么会出现此错误?
注意:如果这个问题已经得到解答,我深表歉意 - 我做了一些查找,但不知道要搜索什么才能找到我的答案。
I am a newbie to Git.
I am in a branch "maintenance" and I want to switch back to "master", but I am receiving the error:
error: The following untracked working tree files would be overwritten by checkout:
vault/users/1/thumb.jpg
vault/users/1/speck.jpg
vault/users/1/prof.jpg
vault/users/1/mini.jpg
vault/users/1/full.jpg
I thought that these images were being ignored because in my .gitignore file, I said to ignore "vault/". Indeed, they don't show up as modified, or added, etc when trying to commit. It seems like the ignore worked.
So, how come when I try and checkout my master branch, it gives me this error?
NOTE: if this has been answered, I apologize - I did some looking but don't know what to search for to find my answer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎有人在之前的提交中添加了这些文件。
我建议您备份这些文件(除非您确定不需要它们),删除它们,然后进行结账。然后,您可以查看日志并找出这些文件的添加时间,并(我猜)创建一个新的提交来删除它们。
It would appear that someone has added those files in a previous commit.
I'd suggest that you back up those files (unless you're sure you don't need them), delete them, then do the checkout. You can then look through the log and find out when those files were added and (I'm guessing) create a new commit that removes them.