This one guide you how to setup gitignore file for your repo
As part of our App development, we maintain code repos by using Github/ Gitlab. One problem that does come with using source control is avoiding adding files that you should not be tracking. These files can be personal IDE settings, for example, these are like .xcuserstate, xcschememanagement.plist extension type of files.
How to Solove This Issue
By Using gitignore(https://www.gitignore.io) to generate a Swift and Xcode file once you generate content by using the above URL, place the content in .gitnignore file extension. And add this file into the repo, this will solve the issue for unwanted file tracking.