“Simplified” git instructions for Lambda School students

My understanding of how to use GitHub is incomplete. I’ve had exactly 1 day’s worth of experience with it, but this might be useful to people with even less experience than what I have. Tomorrow, the focus of the class is GitHub, so if there’s time, I’ll post again with better information.

I’m new to git. I don’t think that I used it properly to submit a project yesterday, but after reviewing a video from BigKnell, at Lambda School, I just went through the following processes and they worked. Yesterday, I went through procedure 1 (To get a project from GitHub) to fork a project to my GitHub account and then download a local copy onto my computer. I repeated the process earlier for today’s project. Both times, I was successful.

Earlier today, I uploaded yesterday’s project to GitHub using procedure 2 (To upload an existing project from your computer onto GitHub). I didn’t do this correctly yesterday – I was too worn out and tried to use the web interface to move documents, which isn’t correct. Today’s upload was successful.

I have to properly try the 3rd procedure (To submit a pull request), which submits a pull request to GitHub. I need to understand it better, but for now, if you’re stuck on how to copy a project to your GitHub account and then download it onto your computer, and then upload your changes to GitHub, the first 2 procedures work.

To get a project from GitHub:

  1. Go to the project page and fork the project to your account (the fork button is on the top-right, forking makes a copy of the project and places it in your online GitHub account)
  2. Click on the green “Clone or Download” button.
    1. Make sure “Clone with HTTPS” is at the top of the dialogue box that opens
    2. Click on the clipboard icon to copy the project URL to your clipboard
  3. Open Git Bash, or whatever terminal (command line) program you use on your local computer
  4. Navigate to the directory/folder where you keep your projects (you might need to Google this, since instructions might be different depending on your terminal program)
    1. I use Git Bash. My projects are in a folder called “git” inside of “My Documents” on my Windows computer
    2. I got there by typing “cd” to change directories to the root directory, then I typed “ls” to list the folders there and saw My Documents. I typed “cd “my documents”” (“my documents” has to be in quotes since there’s a space between words) to go to My Documents and then “cd git” to go to the git subfolder.
  5. Type “git clone“, a space, and then right-click and paste the URL that was copied in step 2 (the URL of the project from GitHub).
    1. This will cause the terminal to copy the project’s files from GitHub onto your computer.
    2. We’re in the root directory of wherever you have your projects. It will create a folder for the project, any needed subfolders, and then copy down the files from the internet.
  6. I have VS Code set up so I can right-click a folder and choose “Open in Code” to automatically add its folders (and hence, the project) to VS Code. I chose to add this option when I installed VS Code. So, its what I do – I essentially import the project into VS Code by right-clicking the folder and choosing “Open in Code”.

To upload an existing project from your computer onto GitHub:

  1. Open Git Bash (or another terminal/command line program if your using a different one)
  2. Navigate to the directory/folder where you keep your projects (you might need to Google this, since instructions might be different depending on your terminal program). Its the same process as Step 4 in the previous section.
  3. Type “git add .” This adds/copies everything in the project folder to GitHub. I think the period is a special flag that means “all”. Wait a few seconds for the terminal program to copy up the files.
  4. Type “git commit -m” and a space and then add a comment in quotes. For example, I last used: git commit -m “Most formatting done. Top area and section spaces need to be added.”
    1. Don’t use special characters, like exclamation points.
    2. You might be asked to enter your GitHub username and password, so have them handy.
    3. I ended up changing my password on GitHub, because the prompt didn’t recognize it when I typed it several times.
    4. The process probably takes about the same amount of time as Step 5 from the previous section.
  5. Type “git push” to push the files your uploaded to wherever pushing sends them. I think its what incorporates the files into the branch.

git_upload

To submit a pull request:

A pull request is something like a request for comments (RFC). Its an alert that lets other people know that you’ve pushed changes to a branch in a repository in GitHub (and probably other similar software packages). When one is submitted, it basically gives other people the opportunity to reach out and review the updated code that was pushed and then contact the uploader to discuss any concerns. I think that after its accepted, it then gets merged into the main codebase.

  1. Click on the “Pull requests” tab right under the repository’s name (usually under your name and the project name).
  2. Click on the green “New Pull Request” button on the right-side of the screen.
  3. Click on the green “Create Pull Request” button on the left-side of the screen.
  4. Type a title in the top text box, and optionally more detailed info in the larger text box below it.
  5. Click the green “Create Pull Request” button below the text boxes.
  6. Once the screen refreshed, the URL to the pull request can then be shared. Its the new address of the page onscreen. I think it’ll have a /pull/####’s at the end. This is the link that’s submitted to Lambda when they want to review your work, too.

 

Leave a comment