Xcode keeps committing DerivedData folder

How do I remove the DerivedData folder from my Xcode’s repo, and how do I permanently prevent it from including it in the commits?

Xcode 3 didn’t have this problem. Started with Xcode 4.1.

  • Pod install private pods URI::InvalidURIError - bad URI(is not URI?)
  • git clone --bare does not include branch master
  • Push older git repo to origin (remote)
  • How to have Git show a file's version history
  • Git - Github push history
  • How to ignore temporary files
  • Solution

    git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch DerivedData/' (for folders)

    git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename_here' (for files)

  • Should Git ever think a file that it got from a pull is now untracked?
  • how to seamlessly integrate subversion and git?
  • Recover from git reset --hard?
  • Can I remove individual files from a git branch without deleting them when merging into another branch?
  • When working with a venv virtual environment, which files should I be commiting to my git repository?
  • Initializing repository from an existing one
  • 2 Solutions collect form web for “Xcode keeps committing DerivedData folder”

    If you want to remove the folder from your previous history you can follow Github’s guide to removing sensitive data.

    If you just want to remove it from here on out, you can remove it from the repo with
    git rm -r --cached folderName/

    Then, add the following line to a file called .gitignore in your root directory
    folderName

    Where is your derived data repo? It’s usually on ~/Library/Developer/Xcode/DerivedData
    It shouldn’t automatically get committed unless you override this default location.

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