Removing .xcuserstate and DS_Store files from git
In Xcode I noticed that .DS_Store and *.xcuserstate always change and don’t need to be commited. So, I wrote a .gitignore file that contains this:
among other entries. Then I used:
git rm --cached *xcuserstate git rm ---cached .DS_Store
To remove the these file types already under version control. However, when I go to merge Xcode tells me that there are changes that need to be committed. Those changes include .DS_Store files and .xcuserstate files.
So, I tried this:How can I Remove .DS_Store files from a Git repository?
find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch find . -name *.xcuserstate -print0 | xargs -0 git rm --ignore-unmatch
and I got the same result. How do I remove these files from source control for good?
- Where is the Git commit info set in Xcode 4?
- What is the 'standard' content of .gitignore for an iPhone (Xcode) project?
- How to remove remote git urls from xcode?
- Xcode 4.4 - no remotes found
- Pod install is staying on “Setting up CocoaPods Master repo”
- error: git-credential-osxkeychain died of signal 11
2 Solutions Collect From Internet About “Removing .xcuserstate and DS_Store files from git”
You need to commit your change after removing them from the staging area.
As you did already, run:
$ git rm --cached path/to/.DS_Store $ git rm --cached *.xcuserstate
Note, you may have some in other directories, so you may need several invocations to get them all. At this point, your removals are staged in the index, but there’s still more to do: add your
.gitignore, and commit the final result:
$ git add .gitignore $ git commit -m "Remove and ignore .xcuserstate and .DS_Store files."
Now they’ll be removed from the repository, and ignored in the future. Note: this will remove the files for other people, even though you used
git rm --cached locally. Unfortunately, there isn’t much you can do about this. Also, the files are still in your history, so depending on what you do, you may see them in other branches until things get merged and all your branches are based on something that has the new commit.
git update-index --assume-unchanged *.xcuserstate .DS_Store and see if it helps
- Can I declare variables inside an Objective-C switch statement?
- xcode All-in-one layout: keyboard shortcut to switch between project and debug page?
- iPhone iOS 5.0 OpenGl ES 2.0
- Disable horizontal scroll in UIScrollView with autolayout
- iOS app with framework crashed on device, dyld: Library not loaded, Xcode 6 Beta
- Conforming to UITableViewDelegate and UITableViewDatasource in Swift?
- how to cache a whole web page with images in iOS
- TableView is not showing data?
- NSMutableSet contains Duplicates
- How to check for Nil
- UIwebview without Cache
- MagicalRecord completion block is not called under test target
- Objective c – NSMutableSet unique object property
- disable scrolling in a UITableView (iPhone SDK 3.0)
- Loading remote html in PhoneGap or Cleaver (Cordova) on iOS