- Learn
- Stack Essentials
- Git & GitHub
- GitHub Collaboration
Beginner15 min1 prerequisite
Use GitHub for hosting repositories, reviewing code with Pull Requests, and managing projects.
GitHub Collaboration
GitHub hosts your repositories and provides tools for collaboration, code review, and project management.
GitHub vs Git
Terminal
Git:
- Version control system
- Runs locally
- Tracks changes
GitHub:
- Hosting service for Git repos
- Code review (Pull Requests)
- Issue tracking
- Actions (CI/CD)
- Collaboration features
Repository Setup
Create New Repository
Terminal
GitHub → New Repository
Name: my-project
Description: My AI-built application
☑ Public / ☐ Private
☑ Add README
☑ Add .gitignore (Node)
Connect Local Project
Terminal
# Initialize local repo
git init
# Add remote
git remote add origin https://github.com/username/repo.git
# Push initial code
git push -u origin main
Clone Existing Repository
Terminal
git clone https://github.com/username/repo.git
cd repo
Pull Requests
What is a Pull Request?
A request to merge your branch changes into another branch:
Terminal
feature/auth ──→ Pull Request ──→ main
│
├── Description of changes
├── Code diff
├── Review comments
└── Approval/Rejection
Create Pull Request
Terminal
# 1. Push your branch
git push -u origin feature/user-auth
# 2. Go to GitHub
# GitHub shows "Compare & pull request" button
# Or: Pull requests → New pull request
PR Description Template
Terminal
## Summary
Brief description of what changed.
## Changes
- Added user authentication
- Created login/signup pages
- Integrated Supabase Auth
## Testing
- [ ] Login works
- [ ] Signup works
- [ ] Password reset works
## Screenshots
(If UI changes)
Review Process
Terminal
1. Author creates PR
2. Reviewers comment on code
3. Author addresses feedback
4. Reviewers approve
5. Author merges PR
6. Branch deleted
Reviewing Code
Terminal
Files changed tab:
- View all diffs
- Click line number to comment
- Suggest changes inline
Review options:
- Comment: General feedback
- Approve: Ready to merge
- Request changes: Needs work
Suggested Changes
Reviewers can suggest specific code:
Terminal
```suggestion
const user = await getUser(id)
```
Author can accept with one click.
Merge Options
| Option | Result |
|---|---|
| Merge commit | All commits + merge commit |
| Squash and merge | One commit with all changes |
| Rebase and merge | Commits replayed linearly |
Squash recommended for clean history.
Issues
Create Issue
Terminal
Issues → New Issue
Title: Login button not working on mobile
Body:
## Bug Description
The login button doesn't respond on iOS Safari.
## Steps to Reproduce
1. Open site on iPhone
2. Tap login button
3. Nothing happens
## Expected Behavior
Login modal should open
Issue Labels
Terminal
bug - Something isn't working
enhancement - New feature
documentation - Documentation updates
good first issue - Good for newcomers
help wanted - Extra attention needed
Link Issues to PRs
Terminal
# In PR description:
Fixes #123
Closes #456
Resolves #789
# GitHub auto-closes issues when PR merges
GitHub Actions
Automatic Workflows
Terminal
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
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
- run: npm test
Common Workflows
Build and Test:
Terminal
- run: npm ci
- run: npm run build
- run: npm test
Deploy Preview (with Vercel):
Terminal
# Vercel auto-deploys from GitHub
# No manual workflow needed
Lint Check:
Terminal
- run: npm run lint
Project Management
GitHub Projects
Kanban boards for tracking work:
Terminal
Project Board:
├── To Do
│ ├── Add dark mode
│ └── Fix mobile menu
├── In Progress
│ └── User authentication
└── Done
├── Initial setup
└── Homepage design
Milestones
Group issues into releases:
Terminal
Milestone: v1.0 Launch
├── Issue: User authentication
├── Issue: Profile page
├── Issue: Settings page
└── Due: March 15
Collaboration Patterns
Solo Developer
Terminal
# Work on main or use branches
git checkout -b feature/new-thing
# ... work ...
git push
# Create PR for self-review
# Merge when ready
Small Team
Terminal
# Always use branches
git checkout -b feature/task-name
# ... work ...
git push
# Create PR
# Request review from teammate
# Address feedback
# Merge after approval
Open Source
Terminal
# Fork repository
# Clone your fork
# Create branch
# Make changes
# Push to your fork
# Create PR to original repo
Repository Settings
Branch Protection
Terminal
Settings → Branches → Add rule
Branch: main
☑ Require pull request
☑ Require approvals (1)
☑ Require status checks
☑ Require branches up to date
Secrets
For environment variables in Actions:
Terminal
Settings → Secrets → Actions → New secret
Name: SUPABASE_SERVICE_KEY
Value: eyJ...
Collaborators
Terminal
Settings → Collaborators → Add people
Roles:
- Read: View code
- Triage: Manage issues
- Write: Push code
- Maintain: Manage repo settings
- Admin: Full access
AI Tool Integration
Lovable
Terminal
Settings → GitHub
Connect repository
Lovable pushes code to GitHub
Bolt.new
Terminal
Export → GitHub
Creates new repository
Includes all generated code
Claude Code
Terminal
# Claude can commit for you
"Commit these changes with message: Add user auth"
# Or manually after Claude edits
git add .
git commit -m "Add user auth (via Claude)"
git push
Cursor
Terminal
# Built-in Source Control panel
# Git operations via UI
# Integrated with GitHub
Common Tasks
Fork and Contribute
Terminal
# 1. Fork on GitHub (button)
# 2. Clone your fork
git clone https://github.com/YOUR-USER/repo.git
# 3. Add upstream remote
git remote add upstream https://github.com/ORIGINAL/repo.git
# 4. Create branch
git checkout -b my-feature
# 5. Make changes, commit, push
git push origin my-feature
# 6. Create PR from your fork to original
Sync Fork
Terminal
git fetch upstream
git checkout main
git merge upstream/main
git push
Rename Branch
Terminal
# Rename locally
git branch -m old-name new-name
# Delete old remote, push new
git push origin --delete old-name
git push -u origin new-name
GitHub CLI
Command-line GitHub operations:
Terminal
# Install
brew install gh
# Login
gh auth login
# Create repo
gh repo create my-app --public
# Create PR
gh pr create --title "Add feature" --body "Description"
# List PRs
gh pr list
# Check PR status
gh pr status
# Merge PR
gh pr merge 123 --squash
Summary
| Feature | Purpose |
|---|---|
| Pull Request | Propose and review changes |
| Issues | Track bugs and features |
| Actions | Automated workflows |
| Projects | Kanban boards |
| Branch Protection | Enforce PR requirements |
Next Steps
Apply what you've learned in guided projects combining all tools.
Mark this lesson as complete to track your progress