I want to use Git for versioning my playgrounds, but I am not sure which files should be ignored and which ones I should commit.
Currently I use following .gitignore
file for playgrounds:
# Xcode user data
xcuserdata
What else should be there?
gitignore should list the names or name-patterns of files that will be found in work-trees when working with your project, but that should not be committed to the project. In other words, it's not OS-specific, it's project-specific.
gitignore file tells Git which files to ignore when committing your project to the GitHub repository. gitignore is located in the root directory of your repo. / will ignore directories with the name.
gitignore file anywhere in the working directory, i.e in any folder where your code prevails. Having said that, the best practice would be to place the . gitignore file in the root directory.
Whether it is a normal project or playgrounds, it is convenient and useful to use one of the standard .gitignore
files for Swift. From the terminal cd
into your project root folder (the one with the .xcodeproj file for a normal project) and run the following command:
curl -o .gitignore https://www.gitignore.io/api/swift
Or alternatively get it from the GitHub source:
curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/Swift.gitignore
You can edit the file to make changes if you need to. I just use the defaults.
From the official github gitignore for Swift
## Playgrounds
timeline.xctimeline
playground.xcworkspace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With