🏠 Home / Hub

🔶 Git Lesson 05 — GitHub Workflow

← Back to Git Menu  |  🏠 Hub

1. Pull Request (PR) — Code Review

Pull Request = "Please merge my branch into main"
Team members တွေ review → comment → approve → merge
Open source projects = essential workflow
# PR Workflow:
1. Create feature branch
   git switch -c feature/dark-mode

2. Make commits
   git commit -m "add dark mode toggle"
   git commit -m "save theme preference to localStorage"

3. Push to GitHub
   git push origin feature/dark-mode

4. GitHub → Compare & Pull Request button
   → Title: "Add dark mode support"
   → Description: what, why, how to test
   → Reviewers: assign teammates
   → Labels: feature, in-review
   → Create Pull Request

5. Reviewer:
   - View changed files → Add comments
   - "Request changes" OR "Approve"
   - After approval → Merge PR

6. After merge:
   git switch main
   git pull origin main
   git branch -d feature/dark-mode

2. Fork — Contribute to Open Source

# Fork = personal copy of someone else's repo
# Use for: contributing to open source projects

1. github.com/vuejs/core → Fork button → Copy to your account
   → github.com/ko-ko/core

2. Clone YOUR fork
   git clone git@github.com:ko-ko/core.git

3. Add original as "upstream"
   git remote add upstream git@github.com:vuejs/core.git
   git remote -v
   # origin   git@github.com:ko-ko/core.git      (your fork)
   # upstream git@github.com:vuejs/core.git        (original)

4. Create branch + make changes
   git switch -c fix/typo-in-readme

5. Push to YOUR fork
   git push origin fix/typo-in-readme

6. GitHub → New Pull Request → FROM your fork TO original
   → vuejs/core ← ko-ko/core:fix/typo-in-readme

7. Maintainer reviews → merges (or rejects)

8. Keep your fork updated
   git fetch upstream
   git switch main
   git merge upstream/main
   git push origin main

3. GitHub Issues

# Issues = bug reports, feature requests, tasks

# Create issue:
# github.com/user/repo → Issues → New Issue
# Title: "Dark mode not working on Safari"
# Description: Steps to reproduce, Expected vs Actual, Screenshots

# Link commit to issue
git commit -m "fix: dark mode on Safari — closes #42"
# → GitHub auto-closes issue #42 when merged to main!

# Link keywords:
# closes #n | fixes #n | resolves #n → close issue
# refs #n   | relates #n            → mention only

# Branch from issue:
# Issue #42 → Create branch → feature/42-safari-dark-mode
# → automatically links branch to issue

4. GitHub Actions — CI/CD

# CI/CD = Continuous Integration / Continuous Deployment
# = auto run tests + deploy on every push/PR

# .github/workflows/ci.yml
name: CI

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm test

      - name: Build
        run: npm run build

  deploy:
    needs: test
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'

    steps:
      - name: Deploy to S3
        run: aws s3 sync ./dist s3://my-bucket
💡 PR create လုပ်တာနဲ့ tests auto run — fail ဖြစ်ရင် merge မလုပ်ခင် fix ပြင်ဖို့ forced

5. GitHub Pages — Free Hosting

# GitHub Pages = static site free hosting (HTML/CSS/JS)
# Perfect for: portfolio, documentation, learning projects

# Method 1: Deploy from branch
# Settings → Pages → Source: Deploy from a branch → main / docs

# Method 2: GitHub Actions deploy (recommended)
name: Deploy to Pages
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: '20' }
      - run: npm ci
      - run: npm run build
      - uses: actions/upload-pages-artifact@v2
        with: { path: './dist' }
      - uses: actions/deploy-pages@v2

# Site URL: https://username.github.io/repo-name

← Git 04  |  Next: Git 06 → Advanced Git →

📌 Study Checklist