Skip to content

Logistical Instructions for Code Review #2

Description

@PatrickFrankAIU

How to Fork a GitHub Repository - Step by Step Instructions

What is Forking?

Forking creates a complete copy of a repository under your own GitHub account. This gives you full control to make changes without affecting the original repository. It's the standard way to contribute to open-source projects and collaborate on code.

Important Distinctions:

  • Fork: Creates a copy of the repository on GitHub under your account
  • Clone: Downloads a repository from GitHub to your local computer
  • Branch: Creates a separate line of development within a repository

Step-by-Step Instructions

Step 1: Fork the Repository on GitHub

  1. Navigate to the original repository in your web browser

    • Go to the repository URL provided by your instructor
    • Make sure you're logged into your GitHub account
  2. Click the "Fork" button

    • Look for the "Fork" button in the top-right area near "Star" and "Watch"
    • Click the Fork button
  3. Choose where to fork

    • GitHub will ask where you want to fork the repository
    • Select your personal GitHub account (should be the default)
    • Click "Create fork"
  4. Verify the fork was created

    • You should now be on YOUR copy of the repository
    • The URL should show your username: github.com/YOUR-USERNAME/repository-name
    • You'll see "forked from ORIGINAL-OWNER/repository-name" under the repository name

Step 2: Clone Your Fork Using Visual Studio Code

  1. Get the clone URL from YOUR fork

    • Make sure you're on YOUR forked repository (check the URL)
    • Click the green "Code" button
    • Copy the HTTPS URL (it should contain your username)
  2. Open Visual Studio Code

    • Launch VS Code on your computer
  3. Clone the repository in VS Code

    • Click "Clone Git Repository..." on the Welcome page
    • OR: Open the Explorer tab and click "Clone Repository"
  4. Paste the repository URL

    • Paste the URL you copied from your fork
    • Press Enter
  5. Choose where to save the repository

    • VS Code will open a folder browser
    • Navigate to where you want to store the project (e.g., Documents/Projects)
    • Click "Select Repository Location"
  6. Open the cloned repository

    • VS Code will ask if you want to open the cloned repository
    • Click "Open" to open the project in VS Code
    • You should now see all the project files in the VS Code Explorer panel

Step 3: Create a Branch for Your Work

  1. Open the Source Control panel

    • Click the Source Control icon in the left sidebar (looks like a branching symbol)
    • OR press Ctrl+Shift+G (Windows/Linux) or Cmd+Shift+G (Mac)
  2. Create a new branch

    • Look at the bottom-left corner of VS Code - you'll see the current branch name (usually "main" or "master")
    • Click on the branch name in the bottom-left corner
    • Select "Create new branch..." from the dropdown menu
  3. Name your branch

    • Type a name for your branch (e.g., "code-review-branch", "my-analysis", etc.)
    • Press Enter
  4. Verify you're on the new branch

    • Check the bottom-left corner again - it should now show your new branch name
    • This confirms you're working on your new branch

Step 4: Make Your Changes

  1. Edit your files in VS Code

    • Make the changes required for your code review
    • Edit files, add comments, fix bugs, etc.
    • VS Code will automatically detect changes and show them in the Source Control panel
  2. Review your changes

    • Go to the Source Control panel (click the branch icon in the left sidebar)
    • You'll see a list of changed files under "Changes"
    • Click on any file to see what you've modified (green = additions, red = deletions)
  3. Stage your changes

    • In the Source Control panel, you'll see files listed under "Changes"
    • Hover over individual files and click the "+" button to stage specific files
    • OR click the "+" button next to "Changes" to stage all files at once
  4. Commit your changes

    • After staging files, they'll appear under "Staged Changes"
    • Type a clear, descriptive commit message in the text box at the top
    • Example: "Add code review analysis and fixes"
    • Click the checkmark button (✓) or press Ctrl+Enter to commit

Step 5: Push Changes to Your Fork

  1. Push your changes

    • In the Source Control panel, look for the "Sync Changes" button (usually shows arrows)
    • OR click the branch name in the bottom-left corner and select "Push"
    • VS Code will push your changes to your GitHub fork
  2. Verify the push was successful

    • Check the bottom-left corner - you should see your branch name without any indicators
    • You can also go to your fork on GitHub to confirm the changes are there

Step 6: Create a Pull Request

  1. Go to your fork on GitHub

    • Navigate to your forked repository in your web browser
  2. Create a pull request

    • You'll likely see a yellow banner saying "Compare & pull request" - click it
    • If not, click "Pull requests" tab, then "New pull request"
  3. Set up the pull request

    • Base repository: Should be the original repository (your instructor's)
    • Base branch: Usually main or master
    • Head repository: Your fork
    • Compare branch: Your branch (code-review-branch)
  4. Add title and description

    • Title: Something like "Code Review Analysis - [Your Name]"
    • Description: Summarize what you've analyzed and changed
  5. Create the pull request

    • Click "Create pull request"
    • Your instructor can now see and review your work

Summary

The fork workflow using VS Code allows you to:

  1. Create your own complete copy of the repository on GitHub
  2. Download and work on the code locally using VS Code's interface
  3. Make changes safely without affecting the original repository
  4. Submit your work back to the instructor via pull request
  5. Learn the standard workflow used in professional software development

The complete process: Fork (copy to your GitHub) → Clone (download to VS Code) → Branch (create workspace) → Edit (make changes) → Commit (save changes) → Push (upload to your fork) → Pull Request (submit for review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions