-1

I am using GitHub desktop for source control, but for some reason there will randomly be thousands of changes that I did not make, sometimes adding files sometimes deleting. Not sure why this is happening or how to stop it but it is making it very difficult to commit the actual changes I want.

This isn't only happening with the pods, it's happening with all files including duplicated assets

enter image description here enter image description here

tHatpart
  • 1,302
  • 3
  • 12
  • 27

1 Answers1

2

Not sure why this is happening or how to stop it but it is making it very difficult to commit the actual changes I want.

From your screenshot, it looks like all the changes are in the Pods directory, suggesting that you're probably running Cocoapods commands that install and/or update your cocoapods, e.g. pod install or pod update. As a dependency manager, the job of the pod command is to manage the third party components that you've installed in your project, so it's no surprise that that command changes files in your project as those components are updated.

There are at least two ways to manage those changes, both of which are fully described on cocoapods.org. In a nutshell, you can:

  • ignore the Pods directory: Set up your .gitignore file so that git ignores the Pods directory. All the information you need to reproduce a given configuration of your project is stored in the Podfile and Podfile.lock files (which are stored outside of Pods), so there's no need to commit all the files belonging to all the pods to your source repo.

  • don't run commands that update pods: You can go ahead and track all the files in Pods if you want to, e.g. if you're worried that some of the pods you need might disappear and prevent you from building your project. If you do, you need to be aware that running any pod commands that update the installed pods may change any of the files in Pods, so you'll need to avoid running them except at those times when you specifically want to update the installed pods.


Update: After I posted the above answer, you commented to say that more files are affected than just those in your Pods directory, and you added another image. That image shows that the affected files have .icloud file extensions, which suggests that the files are being stored in iCloud rather than on your local drive; the files ending in .icloud are placeholders for files that haven't been downloaded to your computer. To avoid that, ensure that your project directory exists locally rather than on some iCloud volume.

Caleb
  • 124,013
  • 19
  • 183
  • 272
  • I should have included this info - it isn't just pods file. It's happening with images (there will be several duplicates in the assets folder) – tHatpart Aug 10 '22 at 16:21
  • 1
    @tHatpart It sounds like you should update the question with all of the examples of files that are changing or moving around, because the answer will depend on the specifics of what you're seeing. – Itai Ferber Aug 10 '22 at 16:29