它说"没有什么可提交的"!
我已经删除了两次。但它仍然在我的分支中。我在 .ignore 中忽略了它,但现在我删除了它。此外,PHPStorm 不会显示它能够从 GUI 中删除。
$ git rm -r --cached .idea
rm '.idea/php.xml'
$ git status
On branch ft-validation-service-fix-missing-orm
Your branch is up-to-date with 'origin/ft-validation-service-fix-missing-orm'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .idea/php.xml
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/AppBundle/Controller/TestController.php
$ git commit . -m 'Remove .idea directory'
On branch ft-validation-service-fix-missing-orm
Your branch is up-to-date with 'origin/ft-validation-service-fix-missing-orm'.
Untracked files:
src/AppBundle/Controller/TestController.php
nothing added to commit but untracked files present
编辑:似乎这被窃听了,我不得不在另一个位置重新克隆存储库,执行 git rm,然后推拉另一个项目。
如果您已经在 .gitignore 文件中添加了.idea
,请将其从 git 缓存中删除。
$ git rm -r --cached .idea
$ git add .
$ git commit -m 'commit message'
$ git status
我猜你/有人已经把 .idea/ 推到了远程。如果是这样,请遵循 -
- 首先,从 .gitignore 中删除 .idea
- 关闭 IDE
转到终端并删除 .idea 文件夹、添加、提交、推送(将从远程中删除 .idea(
# go to project directory using terminal $ rm -rf .idea $ ls -la # make sure .idea is deleted successfully $ git add . $ git commit -m 'remove .idea directory' $ git push origin HEAD # remove the .idea from remote
打开 IDE(将生成新的 .idea(。
- 在 .gitignore 文件中添加 .idea
从 git 缓存中删除 .idea 并查看
git status
应该忽略 .idea 目录。# Add .idea in .gitignore file $ git remove -r --cached .idea # remove .idea from git cache $ git status
您的 commit 命令中有一个不必要的.
,将其删除,它将正常工作:
git commit -m 'Remove .idea directory'
而不是
git commit . -m 'Remove .idea directory'
git 将点解释为要提交的文件列表,它将忽略您暂存的任何内容,而是只在提交中包含列出的文件 - 并且由于某种原因,点与已删除的文件不匹配。
根据Jetbrain的说法
如果决定与其他开发人员共享 IDE 项目文件,请遵循以下准则:
以下是您需要分享的内容:
1 - 项目根目录中 .idea 目录下的所有文件.xml工作区和任务.xml存储用户特定设置
的文件 2 - 所有可以位于不同模块目录中的 .iml 模块文件(适用于 IntelliJ IDEA(
所以如果你想在 Jetbrain 产品中编码,你必须分享它。