14 September, 2020
When a programmer writes an app, they create source code.
Source code is the instructions given to the computer, in a programming language, to achieve a particular goal or solve a given problem.
Programmers make many revisions to the source code of an app while they write it.
This is very much like making many revisions of a sentence or a paragraph while writing an essay.
Source control refers to software that helps programmers keep track of the many revisions of their code.
If needed, a programmer can revert to earlier versions of their source code.
In this class, we use source control software called git and a website called GitHub to share our work with the world and each other.
Let's look now at how to get this all set up for the first time.
Initial Setup Tasks
First, you will need to create an account on GitHub.
Next, we need to give Xcode permission to write to repositories that you store on GitHub.
Finally, if this is your very first time using source control on your computer, here is how to configure your system so that certain files that should never be committed are always ignored.
Cloning an Existing Repository
It's quite common that you will be given some starter code to build upon. Here's how to clone an existing repository from GitHub into Xcode.
When you clone a repository, it's attached to the account of the person who created it on GitHub.com. You'll need to make your copy of a repository point to your own account instead.
Sometimes, you will need to fork and clone a repository instead.
Creating a New Project
You'll also be creating a new project fairly often this year. Most often, we will create an app that runs on a phone, using a framework called SwiftUI. Here's how to create a new project using SwiftUI.
Saving Your Work
After sweating the details to make improvements to a program, you definitely want to save that work! So, here's how to commit and push your code to GitHub.
Finally, it's totally normal to forget how this all works when it's new to you. 😅
Here is a summary that you can print and glue into the inside cover of your black hardcover notebook. Use this when you need a reminder about how to commit and push your work.