Github 101 PC

How to use GitHub Classroom 101 (PC)

This is a quick tutorial based on:

https://www.youtube.com/watch?v=euUdiVU0A_k&feature=youtu.be&t=676

Overview

  • It explains how to use GitHub classroom
  • The idea is you are going to:
    • create a local repository
    • download a GitHub repository to work on
    • when you are finished upload your answer

Step 1

  • Install Git
  • Set git config up:
    • username, email
    • consider using an email
    • text editor

Step 2

  • Navigate to a local folder where you are going to work on project
  • Open git bash (you need have installed it)

  • Initialise folder:

git init
  • A .git folder will have been created

Step 3

On GitHub website: - Clone repository -> Copy URL

Step 4

Back on local git bash:

git remote add origin <url>
https://github.com/mrdavidlewis/hello-world.git
https://github.com/mrdavidlewis/tlacs.git
  • A remote has been added to this repository
  • the remote is given the alias origin
  • the remote is located at the url
git pull origin master

git pull as described https://git-scm.com/docs/git-pull

  • "Incorporates changes from a remote repository into the current branch."
  • git pull is shorthand for git fetch followed by git merge FETCH_HEAD

So what is git fetch. It gets the data from another repository.

Step 5

You can now work on your local copy.

Find out what has changed (locally):

git status

Step 5

Upload your work back to GitHub

git add .
git commit -m "updated readme"

You need your GitHub details when you do this:

git push origin master