This will get you up and running with Git and its usage in VS Code
Upon completion of this guide, you will be able to sucessfully:
Initialize repositories, stage changes, handle merge conflicts, and push code to GitHub without ever leaving your editor. By the end, you'll have a professional version control workflow that saves you time and prevents "spaghetti code" disasters.
📚 Resources & Links:
👉🏻My personal website: https://valerkahere.com/
👉🏻Download VS Code: https://code.visualstudio.com/download
👉🏻Download Git: https://git-scm.com/install/
👉🏻Access the presentation: https://github.com/valerkahere/youtube
⌚Timestamps:
00:00:00 – Seizure Warning
00:00:07 – Intro & Overview
00:00:22 – Git Is a Time Machine
00:00:47 – Prerequisites
00:01:00 – Installing VS Code (Windows & macOS)
00:01:41 – Installing Git (Windows & macOS)
00:04:40 – What Is Git?
00:05:06 – Creating a Project Folder
00:06:14 – What Is git config?
00:06:45 – Disabling GitHub Copilot
00:08:00 – Initializing a Repository (git init)
00:09:36 – Git Configuration (git config)
00:12:29 – Common Git Problems
00:13:30 – Git Environments: Working, Staging, Commit
00:16:45 – Staging Files (git add .)
00:17:53 – Working Directory vs Staging Area
00:19:46 – Creating Commits (git commit -m)
00:22:55 – Committing the Visual Way (VS Code)
00:28:33 – Writing Good Commit Messages
00:29:43 – Fixing the Last Commit (git commit --amend)
00:31:23 – Understanding HEAD
00:34:27 – Fixing the Last Commit (Visual Way)
00:35:53 – Committing Without Staging (What Happens?)
00:36:25 – Git Status Indicators
00:37:32 – Ignoring Files (.gitignore)
00:41:14 – What Are Git Branches?
00:43:28 – Git Branching Workflow
00:54:16 – Remotes: git push & git pull
01:02:54 – Solving Merge Conflicts
01:07:26 – Git Diff & VS Code Diff View
01:12:16 – Final Notes
01:12:50 – Musical Outro 🎵
🖥️ GIT COMMANDS CHEAT SHEET
Set configuration values for your username and email
git config --global user.name YOUR NAME
git config --global user.email YOUR EMAIL
Set default branch to main
git config --global init.default branch main
Get help on a command
git help COMMAND
git COMMAND -h
Initialize a new git repository
git init
Clone a repository
git clone REPOSITORY URL
Add a file to the staging area
git add FILE
Add all file changes to the staging area
git add --all
git add -A
git add .
Check the unstaged changes
git diff
Commit the staged changes
git commit -m "MESSAGE"
Reset staging area to the last commit
git reset
Check the state of the working directory and the staging area
git status
Remove a file from the index and working directory
git rm FILENAME
Rename a file
git mv (OLD NAME) (NEW NAME)
List the commit history
git log
List all the local branches
git branch
Create a new branch
git branch BRANCH NAME
Rename the current branch
git branch -m NEW BRANCH NAME
Delete a branch
git branch -d BRANCH NAME
Switch to another branch
git switch BRANCH NAME
Merge specified branch into the current branch
git merge BRANCH NAME
Create a connection to a remote repository
git remote add (NAME) (REPOSITORY URL)
Push the committed changes to a remote directory
git push (REMOTE) (BRANCH)
Download the content from a remote repository
git pull REMOTE
Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.