使用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
Run Code Online (Sandbox Code Playgroud)
并且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")
Run Code Online (Sandbox Code Playgroud)
知道为什么git不会忽略像我在gitignore中指定的整个目录......?
Vam*_*ire 35
Git永远不会忽略对跟踪文件的更改.由于它看起来像已修改,因此文件受版本控制(通常不应该是idea/workspace.xml文件),因此会跟踪对它的更改.从索引中删除它,保留本地副本git rm --cached .idea/workspace.xml并提交此更改.从那时起,它将被忽略,除非您将其强制添加回存储库或更改您的gitignore设置.
Cod*_*ard 19
提交文件后,将开始跟踪它.
要从此处删除文件,您必须从存储库中删除它们.
您现在需要做的是删除整个.idea文件夹,提交删除,将idea扩展名添加到您的.gitignore文件中.
Note您仍然可以使用该assume-unchanged标志忽略添加的文件
--[no-]assume-unchanged指定此标志时,不会更新为路径记录的对象名称.
相反,此选项设置/取消设置路径的"假定未更改"位.当该
assume unchanged位打开时,用户承诺不更改文件并允许Git假定工作树文件与索引中记录的文件匹配.如果要更改工作树文件,则需要取消设置该位以告知Git.
如果需要在索引中修改此文件,例如在提交中合并时,Git将失败(优雅); 因此,如果上游更改了假定未跟踪文件,则需要手动处理该情况.
从命令行解释如何做也可以通过IDEA完成.
# Remove the file from the repository
git rm --cached .idea/
# now update your gitignore file to ignore this folder
echo '.idea' >> .gitignore
# add the .gitignore file
git add .gitignore
git commit -m "Removed .idea files"
git push origin <branch>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27407 次 |
| 最近记录: |