Back

How to Remove .idea Directory from .git

Volodymyr Hodiak
Volodymyr Hodiak
January 4, 2020 2 min read 9860 views
January 4, 2020 2 min read 9860 views
image

Very often, when creating projects in PhpStorm, at the first commit, people out of habit click “OK” on all IDE questions and the .idea folder gets into the git repository. It can be removed from there very simply.

Table of contents

How to Remove .idea Directory from .git

If you have accidentally added the .idea directory to .git repository, and you don’t want it to be there, then there is an easy way to remove it. You just have to use the command line and do the following:

# Create file .gitignore
touch .gitignore

# Add .idea to .gitignore
echo '.idea' >> .gitignore

# Remove directory from staging
git rm -r --cached .idea

# Add file to git
git add .gitignore

# Commit changes
git commit -m "Removed .idea from git"

# Push changes
git push
POSTED IN:

How about to rate this article?

  • 1
  • 2
  • 3
  • 4
  • 5

let`s get in touch!

    By submitting this form I consent to processing my personal data as described in the Privacy Policy

    Success!
    Thanks for your message.

    While we are processing your request, don’t hesitate and follow us on social networks!

    Michael Askew

    CEO, ASKWHO

    Simon Nilsson

    Co-CEO, Work-Wide Group

    Dr. Arne-Rasmus Draeger

    Executive, ACARiS

    Samuel Bleakly

    Marketing Director, Coto World

    Philip Ly

    CEO, LES Automotive

    Vance Heron

    CTO, PeteHealth

    Tobias Sturesson

    CEO, Fervent

    Alex Reizer

    Product Manager, Kadabra

    Shlomie Singer

    Co-Founder & Owner at uBranded

    Artyom Popov

    Co-Founder at Escape Room

    Michal Nowakowski

    Founder in a Castles.today

    Alex Ostroverkh

    CEO at PettersonApps

    Mariya Osnovina

    Brand Manager – Intersono IVF clinic

    Waleed Kharma

    Managing Director, Foxtrapp

    Pavlo Lysy

    CEO & Founder, Panem