Git not ignoring certain Xcode files in .gitignore

I am new to Git and I am using it to backup an iPhone project I am working on.
I have added a list of files that Git should ignore (xcode files) when I update, but this .perspectivev3 (which is in my .gitignore) file keeps showing up when I go to commit my changes. Does anyone know why this is, or what I am doing wrong?


  • Clone Git Repo With PHP
  • How can I keep a subfolder of a git repo in sync with a subfolder of another git repo
  • Track branch after creation?
  • Is it possible to cherry-pick a commit from another repository without cloning the entire repository?
  • How does Git solve the merging problem?
  • Unaccessible git state
  • Zach

    This is what is in my .gitignore file:

    # xcode noise
    # Textmate - if you build your xcode projects with it
    # old skool
    # osx noise

  • VSCode doesn't recognize remote git repository
  • Git inserted many <<<<< error messages into my sourcecode
  • fatal: remote error: Could not find Repository octocat/myapp
  • Msysgit GPG error
  • How to get a single .gitignore after git svn create-ignore
  • git exit status: 2 with capistrano
  • 3 Solutions collect form web for “Git not ignoring certain Xcode files in .gitignore”

    If it keep showing up in the git status, it must have been added or committed before.

    You need to

    • git rm --cached that file, in order for the git status to not list it anymore (it is was just added, but not committed yet).
    • git rm that file, if it was previously committed (see this question for instance)

    You can use

    $ git rm --cached ./whatever1.txt

    after something is already under version control.

    In fact, if you have “whatever1.txt” under version control and you want to remove it from git, but leave your working tree undisturbed, then just do this:

    $ git rm --cached ./whatever1.txt
    $ echo /whatever1.txt >> ${PROJECT_ROOT}/.gitignore
    $ git status   # this will now show ./whatever1 as "deleted" (from git, not your working tree, and will show gitignore as modified or created)
    $ git commit -a

    And that’s it.

    Only use

    $ git rm

    when you want to remove the file from both the working tree AND the git repo.

    CAVEAT: The likely scenario you would use this is for removing IDE-specific files from git. In this example “whatever1” represents your IDE file(s) you’re removing. If you are working on a project with several people and you push this changeset to a shared repo, then their “./whatever1” files WILL BE DELETED when they pull this changeset. The easy thing to do from here for the people on the receiving end is:

    $ git checkout 1215ef -- ./file-you-want-to-restore ./another-file ./another-etc

    (where 1215ef represents the last commit before the deletion)

    This has the effect of restoring those files that were present at their last commit before the pull. After they have done this those files will be safe and not show up as uncommitted b/c they will fall under the exclusion of gitignore.

    Good luck!

    .gitignore only applies for untracked files. If you’ve git-add’ed files that are otherwise untracked due to .gitignore, they will still be part of the repository.

    Simply remove the files from the repository you don’t want anymore:

    git rm *.perspectivev3
    Git Baby is a git and github fan, let's start git clone.