.gitignore не игнорировать путь .idea
Что мне не хватает, что нужно сделать, чтобы git
игнорировать мой путь .idea/
?
[email protected]:~/dev/1$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
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/.name
modified: .idea/misc.xml
modified: .idea/modules.xml
modified: .idea/vcs.xml
modified: .idea/workspace.xml
modified: src/Receiver.java
modified: test/1/agent/WindowsQueryHandlerTest.java
Untracked files:
(use "git add <file>..." to include in what will be committed)
lib/
mp1.iml
no changes added to commit (use "git add" and/or "git commit -a")
[email protected]:~/dev/1$ cat .gitignore
*.class
# Package Files #
*.war
*.ear
# IDEA config files
.idea/
Ответы
Ответ 1
.gitignore
игнорирует только что добавленные (не проверенные) файлы.
Если у вас есть файлы, которые уже были добавлены в репозиторий, все их изменения будут отслеживаться как обычно, даже если они соответствуют правилам .gitignore.
Чтобы удалить эту папку из репозитория (не удаляя ее с диска), выполните следующие действия:
git rm --cached -r .idea
Ответ 2
добавить .idea/
в .gitignore файл
запустите эти команды в терминале для выполнения миссии:)
git rm -rf .idea
git commit -m "delete .idea"
git push
Ответ 3
Для тех из вас, кто получает fatal: pathspec '.idea' did not match any files
с ответом w0lf:
Вам просто нужно указать полный путь к папке .idea.
Итак, сначала сделайте git status
, который должен показать вам путь к .idea
, если вы сейчас находитесь.
Затем включите путь в команду w0lf: git rm --cached -r example/path/to/.idea