1

I've followed the steps here to remove all my files from git tracking and then added them back to be tracked. After running git status --ignored I could now see the files being ignored, which was what I was trying to fix. Originally, there were several files not being ignored.

Unfortunately, it seems as if that only fixes it on my machine. I committed the code to origin master but everyone downloaded the repository a few weeks ago. What is the best way to ensure everyone is ignoring the same files? Do they just need to run the commands I provided in the above link or is there an easier way to do this?

Also, what about several branches that were created prior to this change? When I checkout the existing branches they are not showing all the files that should be ignored. Do I need to apply this command to each one of the branches as well?

Community
  • 1
  • 1
  • Is your `.gitgnore` file checked into the repository? – kdopen Mar 06 '15 at 23:24
  • Yeah, it is on the master branch on the remote repository, but when I pulled the code down a few weeks ago I noticed some of the files that should have been ignored, weren't being ignored. I did `git rm -r --cached .` then `git add .` and committed the changes and synced to master on the remote repository. When other developers pull down the remote master will they now be ignoring all files as well? I'm thinking so, but not sure. As for the branches that were existing prior to me running the above code, it seems as if they will still be tracking some files included in the .gitignore file? – Caleb Markovich Mar 07 '15 at 00:27

1 Answers1

0

git add . isn't enough to record the deletion of those file in the index.

git add -A . would be better. (See "Difference between “git add -A” and “git add .")
Then commit and push.

Other collaborators, by pulling from the remote repo, would pull the deletion of those files, and benefit from the updated .gitignore then.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250