Skip to content

Latest commit

 

History

History
103 lines (55 loc) · 2.92 KB

File metadata and controls

103 lines (55 loc) · 2.92 KB

< Back to Overview

Lesson 2.1: Introduction to Git

This assignment will teach you the following:

  • Repositories
  • Commits
  • History
  • GitHub

Instructions

Getting Started:

Fork this GitHub repository to create your own working version:

Note: In the screenshot it shows a repository name for an old Intro class eridanus-intro. The repository you should fork is the intro-to-programming one.

Fork Assignment: Step 1

Select your GitHub account from the list and click the green Create Fork button to copy this repository from the Code the Dream School GitHub account to your personal GitHub account

Fork Assignment: Step 2

You should be directed to your forked GitHub repository so you will see your username in the top left instead of Code-the-Dream-School

Fork Assignment: Step 3

(1) Click the "Code" button, (2) select HTTPS and (3) copy the URL for your repository:

Fork Assignment: Step 4

Clone this repository so that the code is available on your local machine:

Hint: Run this command from the directory where you want to store your code

Note: Replace <url> with the URL you copied in the previous step

git clone <url>

Navigate to the directory you just cloned in your terminal:

cd intro-to-programming

Check to be sure you've got the correct GitHub repository linked to your local folder by running the following command in your terminal

git remote -v

After running the above command, you should see the next two lines in your terminal where <url> is the address of your forked copy of the repository (which should look like https://github.com/yourGitHubUsername/classname-intro.git):

origin <url> (fetch)
origin <url> (push)

Create a new local branch to work on separate from the main branch:

git checkout -b lesson-2-1

Now, open the project directory in your code editor and continue to the next section.

Task List:

  • Create a file called index.html
  • Type your name into the file and save

Final Step:

Check the status of your local repository to double-check the changes you made:

git status

Stage the file(s) that you edited:

git add .

Check the status again and notice that the changes from before are now staged:

git status

Create a commit for the changes you made and add a message describing the changes you made:

Note: Replace <message> with your message (example - "created index.html file")

git commit -m "<message>"

Push your commit to the remote repository (visible in GitHub):

git push

Check the log to make sure your commit has been published:

git log --oneline

Create a pull request and submit:

View instructions


Created by Code the Dream