Svelte SWAPI - GitHub Repo

Svelte SWAPI - GitHub Repo

ยท

3 min read

This post is about accessing the GitHub repo that I am putting The Svelte -Star Wars API app that is being creating in my other blog posts. I've done my best to make the walk-through of the Svelte - Star Wars API app to be as complete as possible. I made it a point to explain every change and every line of code. But I do understand that you may want to jump into without typing.

Using Github, I've created a repository for the code. Each stage (blog post) I'll be making a Branch so that it's easy to get the code at the end of that post.

Visiting the Svelte Star Wars API Repo will give you access to the code. The Repo is public so that no account is required to get the code.

There is a lot of things that can be done on a Github repo. but we're going to focus on just two parts.

  1. Branch Selection

  2. Code download options

GithubSvelteRepo.png

1 - When clicked, the branch selection will have a drop down listing the branches. Each blog post will get it's own branch. Select the branch marked for the post before the one you'll be going over. That way you'll have the code for the start.

GithubBranches.png

2 - For downloading the code, you have three choices.

GithubGetCode.png

  • Clone with HTTPS. Using the command line to download the entire repo. You'll then be able to checkout each branch right from the command line.
  • Open with GitHub Desktop. The GitHub Desktop is an app that gives you a Graphical Interface to deal with Git locally
  • Download Zip. This will provide a ZIP file of whichever branch you've selected. If you don't want to download git, this is the only option.

I'll cover clone with HTTPS, that's the most common method.

Clone with HTTPS

With cloning a Git Repo you will need to have Git installed. Not the Desktop App, just git.

On a side note, git and GitHub are not the same thing. GitHub is an online service that holds git repositories. Git is the technology that handles Version Control. For more information check out Basic Git from FreeCodeCamp.

Type this command to download the entire repo. It'll automatically place it in a folder called Svelte-Star-Wars-API.

git clone https://github.com/RussEby/Svelte-Star-Wars-API.git

Once the repo has been downloaded, you'll need to get a list of the branches available. This will list the branches that are available. A star will appear next to the branch that is currently checked out.

git branch

Let's say you want to checkout the branch called Svelte-Template.

get checkout Svelte-Template

Now if you look at the files in the folder it now contains the files at that branch. Keep in mind if you make any changes and check out a different branch the changes will be erased.

You might be thinking, if any changes will be lost when a new branch is checked out why would be use branches? We're not using branches exactly the way it's supposed to be. Normally, you'd work in a branch for a while and then commit the code to that branch. Once you feel you've finished whatever the branch is being used for, it'll be merged into the master branch.

I hope this short detour allows you to get more from the blog post series. On ward we go...

Resources

Git Home Page

GitHub Desktop

Basic Git from FreeCodeCamp

Did you find this article valuable?

Support Tongere by becoming a sponsor. Any amount is appreciated!