5

I have made a naive mistake while setting up my project. We are 3 developers working on one remote repository. While setting up git we never thought that Xcode would produce non-development files and push them to our remote repo. Now once I learnt after crash and burn I made a .gitignore file.

.gitignore looks like this, please do let me know if I should edit this too. (File credit goes too : This question's answer given by Abizem)

# Mac OS X
*.DS_Store

# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/

But now question is there any possibilities that I can untrack all of those listed files from our source control?

or

Can I list all tracked files with their path and later I know a painful way to remove one by one with,

git rm --cached 'file path'
Community
  • 1
  • 1
TeaCupApp
  • 11,316
  • 18
  • 70
  • 150
  • If you aren't that far along into the project you might just want to nuke the repository (just the .git repository, not the files!) and set it up again. – sosborn Jan 31 '12 at 01:45
  • :( we have been committing for 15 to 20 days and it's a lot of files – TeaCupApp Jan 31 '12 at 02:01
  • Yeah, I understand how that goes. You wouldn't lose the files though, just the commit history. – sosborn Jan 31 '12 at 02:54
  • Maybe this to list the files: git ls-files -i --exclude-standard, xargs for the rest. – ergosys Jan 31 '12 at 02:58

1 Answers1

6

Something I've done a few times in these situations, is move all of the files in the repository somewhere else on the filesystem (except .gitignore), then run:

git add --all
git commit -m "Remove all files"

Then add your files back in and run the following:

git add --all
git commit -m "Re-add files"

This second add & commit will adhere to your gitignore file.

Ell Neal
  • 6,014
  • 2
  • 29
  • 54