DEV Community

Ikegbo Ogochukwu
Ikegbo Ogochukwu

Posted on

Git and GitHub tutorials for Beginners

🔰 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
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

👉 Turns your folder into a Git repository


Step 2: Add Files

git add .
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

👉 Moves files to the staging area


Step 3: Commit Changes

git commit -m "Your message"
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

👉 Saves a snapshot of your work


Step 4: Connect to GitHub

git remote add origin <repo-url>
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

Step 5: Push to GitHub

git push -u origin main
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

👉 Uploads your code online


🔄 5. Everyday Git Commands

Check status

git status
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

See history

git log
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

Download updates

git pull
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

Upload changes

git push
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

🌿 6. Working with Branches (Key Skill)

Create a branch

git checkout -b feature-name
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

Switch branch

git checkout main
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

Merge branch

git merge feature-name
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

👉 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
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด
  • 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
🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด 🔥 ข่าวด่วน: kenryikegbo/git and github tutorials for beginners nm - สรุปดราม่าล่าสุด

Top comments (0)