gpt4 book ai didi

gitignore 不会忽略 .idea 目录

转载 作者:IT王子 更新时间:2023-10-29 01:14:27 28 4
gpt4 key购买 nike

在使用 phpStorm IDE 处理 Symfony2 项目时,我已经将几个文件添加到 git ignore,但是一个文件尽管被添加到 git ignore 却总是出现....我已经尝试了多次,但它总是存在

.gitignore 文件:

/app/config/parameters.yml
/bin/
/build/
/composer.phar
/vendor/
/web/bundles/
/app/bootstrap.php.cache
/app/cache/*
!app/cache/.gitkeep
/app/config/parameters.yml
/app/logs/*
!app/logs/.gitkeep
/app/phpunit.xml

#IDE metadata
**.idea/**

#Bash files
run.sh

这是 git 不会忽略的 .idea 文件夹/文件:

On branch develop
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

modified: .idea/workspace.xml

no changes added to commit (use "git add" and/or "git commit -a")

知道为什么 git 不会像我在 gitignore 中指定的那样忽略整个目录吗...?

最佳答案

Git 从不忽略对跟踪文件的更改。由于它显示为已修改,因此该文件处于版本控制之下(idea/workspace.xml 文件通常不应该如此),因此可以跟踪对其所做的更改。使用 git rm --cached .idea/workspace.xml 将其从索引中删除,保留您的本地副本并提交此更改。从那时起,除非您强制将其添加回存储库或更改您的 gitignore 设置,否则它将被忽略。

关于gitignore 不会忽略 .idea 目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36839838/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com