I am having a hard time to study how to use gitignore
For the case to create a brand new Xcode project, and create a gitignore file to ignore unwanted file like the GoogleService-Info.plist , I succeed to do so
But for the case when a Xcode project has already been pushed to GitHub, and it contains a unwanted file that I want to ignore, I don’t know what to do
My failed steps are:
- Delete unwanted file from GitHub repo
- Create a gitignore file in the existing local Xcode project file, add unwanted file name into it, push
And the result is:
-The deletion in GitHub repo becomes a commit. In a result, other users can go back to the early commits and still see the deleted file.
-The gitignore doesn’t work, may be because the unwanted file has already added to a “push list”??
And then I tried to create a new repo on GitHub, at the same time using gitignore to ignore the unwanted file in the same local Xcode project, and push to the new GitHub repo.
Then I found that the unwanted file is still there, and the new GitHub repo contains all the early commits
At last I have to start form stretch, create a new Xcode project, manually copy code to the new project, and add gitignore before I init a git, and its works finally
Is there a cleverer way to remove and ignore a unwanted file from a already pushed GitHub repo?