DEV Community

Shreya
Shreya

Posted on • Edited on

Git Basics for the Serverless Camp

Before we start working on anything, we want to make sure to clone this repository so that you can easily edit your work and make pull requests locally.

First time connecting with GitHub from your computer? Check out this website on Connecting to GitHub with SSH

Cloning A Repository

Prepare:

  1. Open Visual Studio Code (VS Code) on your computer
    • We will be using VS Code as our code editor
  2. Open a new terminal (top menu > Terminal > New Terminal)

Run the following commands in the terminal to create a space for your work in Camp.Dev:

  1. pwd to "print working directory" (check the name of the directory/folder you are currently working in)
  2. ls to see what's inside this directory
  3. mkdir Camp-Dev (make directory) to create a new directory for all your Camps
  4. cd Camp-Dev to "change directory" (move) into the new folder that you just created

Run the following commands in the terminal to clone the repo:

  1. git init to initialize the repository
  2. git clone [link-to-repo] to create a copy of this repo on your device
  3. ls to check the name of the folder that you just cloned
  4. cd [folder-name] to "change directory" (move) into the new folder that you just cloned
  5. git branch to check which branch you're currently in (should say either main or master)
  6. git checkout -b w1s1 (w1s1 = week 1 step1) to create a new branch (this should automatically move you to the new branch you create)
  7. Optional: git checkout w1s1 to change branch to w1s1 (you can use this command when you have previously made a branch and don't need to create a new one)

This is what your terminal should look like:

git init

git clone

move into cloned repo

How to make a Pull Request

  1. git branch to check which branch you're in
  2. git pull to pull any updates from the remote (online) repository (repo)
  3. git checkout w1s1 if you're in main, move to w1s1 for week 1 step 1 with (or the name of the branch you were editing in)
  4. git add notes.md to add the files you were editing
    • git add . will add all the changed files including all new ones (use this when you edit or add multiple files to save time)
  5. git commit -m "[your-commit-message]" change [your-commit-message] to specifically what changes you are committing
    • make sure there are no errors in this step
    • if there are errors and you're not sure how to proceed, reach out to an instructor on the Bit Project Discord
  6. git push to push all changes to the remote repo

    push changes

  7. go to the github website and check to see if it updated notes.md with the changes you made on your computer

  8. click on the button that says: "Compare & Pull Request"

    compare and pull request

  9. leave a comment stating which specific step this PR is for

  10. create the pull request

    • if there are any merge conflicts and you're not sure how to proceed, reach out to an instructor on the Bit Project Discord

    comment and create

Top comments (0)