Search code examples
xcodegithubcocoapodsgitignore

Added pod files and pushed. How to undo? how to use gitignore in Xcode & github?


This is a two part question: 1) I have added committed and pushed all pod files to github. Is there a way I can remove them and not push them again to github?

2) I know gitignore can help, but I don't know how to use it. Can anyone please walk me through the process of using gitignore?

so I think what I can do is, get the project from github, add gitignore, and then push again. is that correct?

Please help, new to github & Xcode.


Solution

  • That's correct, you need to add the Pods directory to your .gitignore

    1) Remove your files from your github repository:

    git rm -r Pods/
    

    and don't forget to commit and push

    2) Create a gitignore file:

    1. Open terminal and go through your project folder where the .git folder is located
    2. Type touch .gitignore
    3. Type echo "Pods/" > .gitignore

    3) (Added from Gabriel's comment) Last step, remove them from the remote:

    git rm -r --cache Pods/
    

    More informations : here