Git

Make sure you’ve installed VS Code, Git, and have configured as outlined in ICJ Setting Up Part 1 before continuing here.

Defining version control

Search on google and you’ll find a ton of posts, tutorials and videos about Git and version control systems. I encourage you to explore some that fit your learning style. We’ll just cover enough here to get you going and we’ll learn by doing.

At its most basic, Git allows you to save your work at intervals and it keeps a history of files on your computer when you choose to save them. Once you have something that works, you can “commit” it and leave a comment about what you’ve done. You can then go back to that exact point in time if you need to. This frees the developer to experiment and make changes that may NOT work, because you know you can always go back. It works for any kind of file you want to put under version control.

Git allows for a “distributed” version control system, meaning that all the code can be stored on a central server (like on the Internet) so other people can work on the shared code. When they “check out” a repository (or repo), they get the entire code base. Contributors can then make changes and “check in” those changes for others to use.

Github is the central server we will use to save our code. It’s also a project management tool and a social network of sorts. It’s probably the most popular programming service on the planet. Bitbucket Cloud is another popular code sharing service.

Our goals

We will create a project folder and that that work as a repository — or “repo” — in git. We’ll break our work into the folowing steps:

  • Create a local repo inside our icj project folder.
  • Create a public repo on Github.
  • Connect the local repo to public Github repo.
  • Edit files and use the git cycle to save and push your changes to Github.

Visual Studio Code

We’ll start using our code editor, Visual Studio Code, with this assignment. I’ll sometimes refer to this program as VS Code or just Code.

In our computer setup and command-line lessons, we used either the Terminal/Git Bash programs to talk to our computers. Now that we have VS Code installed, we’ll almost always use our Terminal from inside VS Code. It’s the same thing, just tucked inside VS Code.