Ali
Ali

Reputation: 267049

.gitignore is not having an effect

I have a project set up in /home/xxx/project. My .gitignore is in /home/xxx/project/.gitignore, and I'm trying to add the file /home/xxx/project/.idea/workspace.xml to gitignore. Here's my .gitignore file:

target/
uploads/
*.class
.idea/workspace.xml

All the other lines work, but the last one has no effect, and I keep seeing changes from workspace.xml when I try to commit.

What am I doing wrong?

Upvotes: 0

Views: 718

Answers (1)

thescientist
thescientist

Reputation: 2948

If you have already set this file for tracking in Git, it's too late to add it to .gitignore and see the behavior your expecting.

What I would do is:

  1. Back this file up somewhere
  2. Delete it from Git
  3. Add it to .gitignore
  4. Move the file back into your workspace
  5. git status (should not show the file)

Upvotes: 3

Related Questions