Как удалить папку idea из git репозитория
Перейти к содержимому

Как удалить папку idea из git репозитория

  • автор:

How to remove the .idea folder from git

If you’ve inadvertently committed the .idea folder to your git repo, and don’t want it in there, it’s an easy change to revert.

Note: These instructions should work for any JetBrains product–IntelliJ, WebStorm, etc.

  1. Blacklist the .idea folder by adding the “.idea” folder to the .gitignore file in master, then commit this change.
  2. In your branch, check this file out from master. git checkout master — .gitignore
  3. Remove the .idea folder from the git tree

git rm —cached -r .idea

and commit this change to your branch.

To restore your editor configs:

  1. Use the PHPStorm registry to reveal the files: https://stackoverflow.com/questions/33010238/show-idea-folder-in-phpstorm-project-tool-window
  2. Right click the .idea folder, select “local history,” then revert back to an earlier working version.

Updated: August 04, 2017

Comments
You May Also Enjoy

July 2023 — Weekend in the Wallowas

A weekend backpacking trip to Ice Lake, in the Wallowas

Sabbatical Week 4 — Cat Ba Island, Hanoi, Da Nang, and Seoul

A chill last week of sabbatical in Vietnam and South Korea

Sabbatical Week 3 — Ninh Binh, Hanoi, and Ha Long Bay

I spent the third week of my sabbatical exploring northern Vietnam and on a cruise in Ha Long Bay

Как удалить папку .idea из Git

Начиная новый проект в PhpStorm (при работе с Git) необходимо создать в корне проекта файл .gitignore , в который внести директорию .idea (служебная директория PhpStorm). Тем самым мы исключаем .idea из отслеживаемых Гитом файлов и он не попадает в репозиторий.

Создать файл .gitignore можно руками или же с помощью плагина для PhpStorm.

Add gitignore

Если директория .idea всё же попала в репозиторий Git, её оттуда можно удалить.

Или же можно так:

  • git
  • phpstorm

Ещё в блоге

PHP: Загрузка файлов на сервер

Основы по загрузке файлов на сервер с помощью PHP

Примеры реализации ротатора баннеров (изображений) для сайта с с помощью чистого Javascript и jQuery. Изображения м.

jQuery скрипты для компонентов Bulma

Примеры jQuery скриптов для компонентов Bulma

Интересный эффект при наведении на карточку товара, используя чистый CSS3. Описание товара выезжает из под картинки.

Accidentally committed .idea directory files into git

I have accidentally committed the .idea/ directory into git. This is causing conflicts everywhere else I need to checkout my repo. I was wondering how do I remove these files from the remote?

I still need these files locally since the Intellij IDE needs them. I just don’t want them in the remote. I have added the directory .idea/ to my .gitignore and committed and pushed this file into remote. This seems to have no effect during my checkout on my other machine though. I still get the error message:

BuZZ-dEE's user avatar

6 Answers 6

Add .idea directory to the list of ignored files

First, add it to .gitignore , so it is not accidentally committed by you (or someone else) again:

Remove it from repository

Second, remove the directory only from the repository, but do not delete it locally. To achieve that, do what is listed here:

Send the change to others

Third, commit the .gitignore file and the removal of .idea from the repository. After that push it to the remote(s).

Summary

The full process would look like this:

(optionally you can replace last line with git push some_remote , where some_remote is the name of the remote you want to push to)

You can remove it from the repo and commit the change.

After that, you can push it to the remote and every checkout/clone after that will be ok.

Ricardo Souza's user avatar

Its better to perform this over Master branch

Edit .gitignore file. Add the below line in it.

Remove .idea folder from remote repo. using below command.

Stage .gitignore file. Using below command

git commit -m ‘Removed .idea folder’

rahulnikhare's user avatar

if you haven’t push to git

if "git rm .idea/ -r —cached" throw an error "fatal: pathspec ‘.idea’ did not match any files" and already push to git with .idea on it.

Mark Anthony Libres's user avatar

You should add a .gitignore file to your project and add /.idea to it. You should add each directory / file in one line.

If you have an existing .gitignore file then you should simply add a new line to the file and put /.idea to the new line.

After that run git rm -r —cached .idea command.

If you faced an error you can run git rm -r -f —cached .idea command. After all run git add . and then git commit -m «Removed .idea directory and added a .gitignore file» and finally push the changes by running git push command.

Как удалить папку .idea из git-репозитория

Очень часто при создании проектов в PhpStorm от компании JetBrains при первом коммите народ по привычке нажимает «ОК» на все вопросы IDE и папка .idea попадает в git-репозиторий, которой там совсем не место. Удаляется оттуда она очень просто.

Сами ребята из JetBrains рекомендуют такой файл .gitignore :

Если у вас возникают какие-либо вопросы по редактору блоков Gutenberg, залетайте в наш ванильный русскоязычный чат по Gutenberg в Telegram.

Русский разработчик со стажем. Работаю с PHP, ООП, JavaScript, Git, WordPress, Joomla, Drupal.

Оптимизирую сайты под Google Page Speed, настраиваю импорты для больших магазинов на WooCommerce + WP All Import. Пишу плагины на заказ. Все мои услуги.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *