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 file.

.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)

  • Cloning git repo
  • Why does `git-svn` hang at `Found possible branch point:`
  • gitignore - hide ignored files during checkout
  • Workflow for using Git SVN and a Remote Git Repository with multiple users
  • git pull from remote… can I pull a specific commit?
  • How to tell who was the author of removed line?
  • # Mac OS X
    # Xcode

    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'

  • Gitolite VREF/NAME - what not to push
  • ls-remote reports phantom tags ending with “^{}”
  • Git commit -a opens GNU nano 2.2.6 How should I change it to open Vim instead?
  • Append ticket number using git commit hooks?
  • Will remote URL for fetch and push be different?
  • Is it possible to create merge requests in pure Git from the command line?
  • 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.

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