Naive Git setup, Is it possible to untrack files which are listed on my .gitignore?
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 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?
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'
One Solution collect form web for “Naive Git setup, Is it possible to untrack files which are listed on my .gitignore?”
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.