What should I include in the .gitignore file for S

2019-04-20 09:29发布

问题:

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?

回答1:

From the official github gitignore for Swift

## Playgrounds
timeline.xctimeline
playground.xcworkspace


回答2:

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.