Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should I include in the .gitignore file for Swift playgrounds?

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?

like image 696
Dalija Prasnikar Avatar asked Jul 15 '15 17:07

Dalija Prasnikar


People also ask

What should be in the Gitignore file?

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.

What would you use a .gitignore file for?

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.

Where do I put my .gitignore file?

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.


2 Answers

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.

like image 120
Suragch Avatar answered Oct 23 '22 12:10

Suragch


From the official github gitignore for Swift

## Playgrounds
timeline.xctimeline
playground.xcworkspace
like image 9
Damodaran Avatar answered Oct 23 '22 12:10

Damodaran