π° 1. What is Git?
Git = Version Control System
π It helps you:
- Track changes in your code
- Go back to previous versions
- Collaborate with others safely
Think of it like:
βGoogle Docs version historyβ¦ but for codeβ
Git records every change as a snapshot (commit) ([FreeCodeCamp][1])
π 2. What is GitHub?
- GitHub is a cloud platform that hosts Git repositories
-
It allows:
- Collaboration
- Sharing code
- Team development
π Key idea:
- Git = tool
- GitHub = online platform using Git ([product.hubspot.com][2])
ποΈ 3. Core Git Concepts (VERY IMPORTANT)
π Repository (Repo)
A project folder tracked by Git
π§Ύ Commit
A saved snapshot of your work
π¦ Staging Area
Where you prepare changes before saving
πΏ Branch
A separate version of your project (for new features)
π Merge
Combining branches together
βοΈ 4. Basic Git Workflow (The Heart of Everything)
This is the main flow taught in the video:
Step 1: Initialize Git
git init
π Turns your folder into a Git repository
Step 2: Add Files
git add .
π Moves files to the staging area
Step 3: Commit Changes
git commit -m "Your message"
π Saves a snapshot of your work
Step 4: Connect to GitHub
git remote add origin <repo-url>
Step 5: Push to GitHub
git push -u origin main
π Uploads your code online
π 5. Everyday Git Commands
Check status
git status
See history
git log
Download updates
git pull
Upload changes
git push
πΏ 6. Working with Branches (Key Skill)
Create a branch
git checkout -b feature-name
Switch branch
git checkout main
Merge branch
git merge feature-name
π Why branches matter:
- Work on features without breaking main code ([product.hubspot.com][2])
π€ 7. Collaboration Workflow (GitHub Flow)
This is how teams work:
- Create branch
- Make changes
- Push branch
- Open Pull Request (PR)
- Review
- Merge
π Pull Request = βPlease review my changesβ
π§ 8. Mental Model (Very Important)
Think of Git like this:
Working Directory β Staging β Commit β GitHub
- Working β you edit files
- Staging β you prepare changes
- Commit β you save version
- GitHub β you share it
β‘ 9. Common Beginner Mistakes (From the Video)
- β Forgetting to
git add - β Bad commit messages
- β Working directly on main branch
- β Not pulling before pushing
π 10. Your First Practice Exercise
Try this:
mkdir my-project
cd my-project
git init
echo "Hello Git" > file.txt
git add .
git commit -m "First commit"
# connect to GitHub repo
git remote add origin <your-repo-url>
git push -u origin main
Top comments (0)