7

I added a git ignore file to my Xcode project with the following commands: touch .gitignore then open .gitignore and copy and pasted this into the git ignore content (and uncommented the line that had Pods/ line) and saved the file.

But when I still try to commit (have already committed numerous times) in Xcode, the Pods file is still there and already checked to commit.

How can I have my Pod file not be checked and have the git ignore work with my Xcode project?

ap123
  • 916
  • 1
  • 8
  • 22

1 Answers1

8

This question is generic to how git works. Since you've already committed the Pods/ directory, you'll want to first make a commit that removes them. You can title this commit "Remove Pods". Do not edit the .gitignore file in this commit or else the delete will not be respected.

After you've made that commit, add the .gitignore file with the Pods/ line uncommented and make another commit title say "Add .gitignore file".

From now on, changes to the Pods/ directory will not be checked in.

lovelikelando
  • 7,593
  • 6
  • 32
  • 50
  • I never committed the Pods file but i still did `git rm -r Pods` in terminal just incase and committed the gitignore file. But when I go to commit in Xcode or even terminal all of the files in Pods is still marked to be committed. Is there anything else I can try? – ap123 Aug 27 '19 at 03:47
  • 1
    Have you tried this? https://stackoverflow.com/questions/936249/how-to-stop-tracking-and-ignore-changes-to-a-file-in-git?rq=1 – lovelikelando Aug 27 '19 at 03:48