ctrutmann
ctrutmann

Reputation: 41

How to change Xcode 'xcuserdata' after not including it in .gitignore?

I started a React Native project without a .gitignore, and foolishly committed and merged build files, unsure of what they were and erring on the side of caution. Things like this:

    modified:   ios/build/Build/Intermediates/RCTActionSheet.build/Debug-iphonesimulator/RCTActionSheet.build/dgph
modified:   ios/build/Build/Intermediates/RCTActionSheet.build/Debug-iphonesimulator/RCTActionSheet.build/dgph~
modified:   ios/build/Build/Intermediates/RCTGeolocation.build/Debug-iphonesimulator/RCTGeolocation.build/dgph
modified:   ios/build/Build/Intermediates/RCTGeolocation.build/Debug-iphonesimulator/RCTGeolocation.build/dgph~
modified:   ios/build/Build/Intermediates/RCTImage.build/Debug-iphonesimulator/RCTImage.build/dgph
modified:   ios/build/Build/Intermediates/RCTImage.build/Debug-iphonesimulator/RCTImage.build/dgph~
modified:   ios/build/Build/Intermediates/RCTLinking.build/Debug-iphonesimulator/RCTLinking.build/dgph
modified:   ios/build/Build/Intermediates/RCTLinking.build/Debug-iphonesimulator/RCTLinking.build/dgph~
modified:   ios/build/Build/Intermediates/RCTNetwork.build/Debug-iphonesimulator/RCTNetwork.build/dgph
modified:   ios/build/Build/Intermediates/RCTNetwork.build/Debug-iphonesimulator/RCTNetwork.build/dgph~
modified:   ios/build/Build/Intermediates/RCTSettings.build/Debug-iphonesimulator/RCTSettings.build/dgph
modified:   ios/build/Build/Intermediates/RCTSettings.build/Debug-iphonesimulator/RCTSettings.build/dgph~
modified:   ios/build/Build/Intermediates/RCTText.build/Debug-iphonesimulator/RCTText.build/dgph
modified:   ios/build/Build/Intermediates/RCTText.build/Debug-iphonesimulator/RCTText.build/dgph~
modified:   ios/build/Build/Intermediates/RCTVibration.build/Debug-iphonesimulator/RCTVibration.build/dgph
modified:   ios/build/Build/Intermediates/RCTVibration.build/Debug-iphonesimulator/RCTVibration.build/dgph~
modified:   ios/build/Build/Intermediates/RCTWebSocket.build/Debug-iphonesimulator/RCTWebSocket.build/dgph
modified:   ios/build/Build/Intermediates/RCTWebSocket.build/Debug-iphonesimulator/RCTWebSocket.build/dgph~
modified:   ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/dgph
modified:   ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/dgph~
modified:   ios/build/Build/Intermediates/SolveMe.build/Debug-iphonesimulator/SolveMe.build/dgph
modified:   ios/build/Build/Intermediates/SolveMe.build/Debug-iphonesimulator/SolveMe.build/dgph~
modified:   ios/build/Build/Intermediates/SolveMe.build/Debug-iphonesimulator/SolveMeTests.build/dgph
modified:   ios/build/Build/Intermediates/SolveMe.build/Debug-iphonesimulator/SolveMeTests.build/dgph~
deleted:    ios/build/Logs/Build/595432B6-D8CF-4CCE-B44B-B90E24325848.xcactivitylog
modified:   ios/build/Logs/Build/Cache.db    

Now it turns out this has set the module cache path to '/Users/MY_USERNAME/...', for other people attempting to clone this project from GitHub and run it on their local machines.

I have since added this Xcode .gitignore template, recommended in another StackOverflow question about .gitignore's for Xcode.

MAIN QUESTION: What is the best way to change this Derived Data on GitHub so the rest of the team can work on this project? Or, where can they change it locally to make it work for them? Having them delete their ios/build/ folder seems to have fixed the problem. Is that an acceptable solution, or is it secretly disastrous?

I've heard of some pretty convoluted work-arounds from people I've asked in person. Any help will be appreciated!

Upvotes: 1

Views: 619

Answers (1)

OregonTrail
OregonTrail

Reputation: 9039

After adding a file or directory to .gitignore it also needs to be removed using git rm to remove it from the repo.

e.g.

git rm ios/build
git commit

Then, your team can remove their ios/build dir, pull to the latest commit, and rebuild.

Things will work smoothly from there.

Upvotes: 3

Related Questions