0

Newbie to git workflow.

I've started working on an open source project. I forked the repo.

However when I push my commits to the remote fork an .idea/ directory is generated on GitHub. Github repo. My gitignore file contains the .idea/ path.

I've deleted ./idea on my local git repository with the help of this Remove a file from a Git repository. However when I push to the remote the directory .idea/ remains.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
flutter
  • 6,188
  • 9
  • 45
  • 78

1 Answers1

3

My gitignore file contains the .idea/ path.

Once you commit the file it will begin to be tracked. so it not enough to add it to your .gitignore, you have to remove it from the repository as well.

In order to remove the file from this point, you have to remove them from the repository.

git rm --cached .idea/

This command only deletes the file from the staging and not from your file system, later on, add to to the .gitignore.

What you need to do now is to delete the entire .idea folder, commit the deletion, add the idea extension to your .gitignore file.

# 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>
Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167