VS Code

VS Code + GitHub Guide

Check if Git is Installed

git --version

Set Username and Email

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Clone a GitHub Repository

Open Command Palette Ctrl+Shift+P or Cmd+Shift+P and choose:

Git: Clone

Push Changes to GitHub

Or use Command Palette:

Git: Push

Working with Branches

Pull a Specific Branch

git fetch origin
git checkout your-branch-name
git pull origin your-branch-name

Create New Branch from Master

git checkout master
git pull origin master
git checkout -b new-branch-name

Push a New Branch to GitHub

git checkout -b your-new-branch
git add .
git commit -m "Your commit message"
git push -u origin your-new-branch

Deploying to GitHub Pages

Initialize and Push Repository

git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin [your-repo-url]
git push -u origin main

Enable GitHub Pages

Go to your GitHub repository settings and:

Open or Edit HTML in Terminal

# Open in VS Code
code index.html

# Open in default browser (macOS)
open index.html

Start Fresh in a New Repository

Step-by-Step: Exit Current Repo & Start a New One

Follow these commands to back out of a current repo and begin working in a separate new one:

1. Move Up One Level in Terminal

cd ..

2. Navigate to Your Desired Directory

cd your-folder-name

3. Clone the New Repository

git clone [new-repo-url]
cd your-new-repo-folder

4. Add and Push Your Project

git add .
git commit -m "Initial project commit"
git push -u origin main
Created with the assistance of VS Code Copilot GPT