Skip to content

Instantly share code, notes, and snippets.

@dovakeen118
Last active March 31, 2022 18:22
Show Gist options
  • Save dovakeen118/4b0197df1ee3d5c87c0345733e0592bd to your computer and use it in GitHub Desktop.
Save dovakeen118/4b0197df1ee3d5c87c0345733e0592bd to your computer and use it in GitHub Desktop.

How to Clone a GitHub Repo:

  1. From the GitHub repo page, make sure the left dropdown menu is on the main branch in order to get a fresh copy that you can start from scratch, without the completed code (see below how to change branches)
  2. Then, click the green Code button and copy the HTTPS path
  3. In your terminal, navigate to the folder where you want to keep the repo (could be challenges or a different folder)
  4. In your terminal, type git clone <-paste copied git path->. This will add the repo as a new directory within the folder you chose (this is just like et get)
  5. You can then cd into that new directory, based on the name of the repo
  6. By default, it will most likely give you the GitHub branch for the starter code (branch is either named master or main). You can then open this with VSCode (code .) to code through the starter code yourself, or if you would like to see the finished code in your editor… >>>
  7. If there is a branch for completed code (usually named something like boston-32) you can checkout that branch to see the code in VSCode, rather than looking at it on GitHub. To see what branches are available, go to the repo on GitHub, on the left side there is a dropdown for all branches.
    • You can also check available branches directly from the terminal if you run the command git branch -a to get a list of branch names
  8. Find the one for your cohort to get the correct branch name. From the terminal, you can run git checkout <-branch name->

Note: In your terminal and VSCode, you can only have ONE branch open at a time. If you switch branches in the terminal, your VSCode will automagically switch to that branch as well. If you want to see 2 branches at once (i.e. the starter code and completed code) it might be easier to have one open in VSCode and the other open on GitHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment