VOOZH about

URL: https://dev.to/kenryikegbo/git-and-github-tutorials-for-beginners-41nm

⇱ Git and GitHub tutorials for Beginners - DEV Community


πŸ”° 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:

  1. Create branch
  2. Make changes
  3. Push branch
  4. Open Pull Request (PR)
  5. Review
  6. 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