Basic question re: removing directories

Newb here, sorry.

I’m developing an iPhone app in XCode and it uses git for version control. I updated to the newest ‘realm’ library in the XCode project, and suddenly I found that all the realm files were under version control, when previously they weren’t.

I want to simply remove them from version control, but not delete them.

This seemed like the correct command, and it looks good when I use -n, but I wanted to make sure.

git rm -r 'realm*'

Will this delete the actual files too? I don’t want that. Thank you!

UPDATE:

Actually, git rm -r ‘Realm*’ (capital R) shows me I have edited Realm files (not my files), declining to remove them. This suggests it was under VC before. But the question remains, how to do I remove these files from VC, regardless of outstanding changes.

What you’re looking to do is “ignore” the contents of a directory. This allows the files to be stored locally, but not get stored in the repository history. Unfortunately, when they are already in the repository, it is a multi-step process to get everything to where it sounds like you want to go:

  1. Back up the files you want to keep by copying them elsewhere
  2. Remove the files from the repository by using git rm and then git commit (this will delete the files locally too, which is why we backed them up in step 1)
  3. Add a line to your .gitignore file in the base directory of the repository instructing git to ignore the directory you wish to not be in the repository
  4. Commit the change to your .gitignore file
  5. Copy the backed up files back into place

Let us know if you have more questions.