Welcome to the Forking Workflow simulation repository! This repository serves as the upstream repository for learning and practicing the Git forking workflow.
By the end of this exercise, you will understand how to:
- Fork a repository on GitHub
- Clone your forked repository
- Configure upstream remote
- Create feature branches
- Make changes and commit them
- Push changes to your fork
- Create Pull Requests
- Sync your fork with upstream changes
- Git installed on your machine
- GitHub account
- Basic understanding of Git commands
The forking workflow is ideal for open source projects and distributed teams. Here's how it works:
┌─────────────────┐ Fork ┌─────────────────┐
│ Upstream │ ────────► │ Your Fork │
│ Repository │ │ (Origin) │
│ (This Repo) │ │ │
└─────────────────┘ └─────────────────┘
│ │
│ │ Clone
│ Pull Request ▼
│ ┌─────────────────┐
└───────────────────── │ Local Copy │
│ (Your Machine)│
└─────────────────┘
- Click the "Fork" button at the top right of this repository page
- Select your GitHub account as the destination
- Wait for GitHub to create your fork
# Replace YOUR_USERNAME with your actual GitHub username
git clone https://github.com/YOUR_USERNAME/version-control-system-hari-senin.git
# Navigate to the project directory
cd version-control-system-hari-senin# Add the original repository as upstream
git remote add upstream https://github.com/madewantara/version-control-system-hari-senin.git
# Verify remotes
git remote -vYou should see:
origin https://github.com/YOUR_USERNAME/version-control-system-hari-senin.git (fetch)
origin https://github.com/YOUR_USERNAME/version-control-system-hari-senin.git (push)
upstream https://github.com/madewantara/version-control-system-hari-senin.git (fetch)
upstream https://github.com/madewantara/version-control-system-hari-senin.git (push)
-
Create a new branch for your changes:
git checkout -b add-your-name
-
Edit the
contributors.yamlfile and add your information:# Add your entry following the existing format - name: "Your Full Name" github: "your-github-username" role: "Student" batch: "18" # Your batch number skills: ["skill1", "skill2", "skill3"] favorite_language: "JavaScript" # or your preferred language joined_date: "2025-12-20" # Today's date
-
Commit your changes:
git add contributors.yaml git commit -m "Add [Your Name] to contributors list" -
Push to your fork:
git push origin add-your-name
-
Create a Pull Request:
- Go to your fork on GitHub
- Click "Compare & pull request"
- Write a descriptive title: "Add [Your Name] to contributors"
- Add a description of your changes
- Click "Create pull request"
# Fetch latest changes from upstream
git fetch upstream
# Switch to main branch
git checkout main
# Merge upstream changes
git merge upstream/main
# Push updated main to your fork
git push origin main- Always create feature branches - Never work directly on
main - Sync frequently - Keep your fork updated with upstream changes
- Write clear commit messages - Describe what and why, not just what
- Small, focused PRs - One feature or fix per pull request
- Test before submitting - Make sure your changes work
# Check current status
git status
# See commit history
git log --oneline
# Check which branch you're on
git branch
# Switch branches
git checkout branch-name
# Create and switch to new branch
git checkout -b new-branch-name
# Add files to staging
git add filename
git add . # Add all files
# Commit changes
git commit -m "Your commit message"
# Push to your fork
git push origin branch-name
# Pull latest changes
git pull origin mainIf you encounter merge conflicts:
- Open the conflicted files
- Look for conflict markers (
<<<<<<<,=======,>>>>>>>) - Manually resolve conflicts
- Remove conflict markers
- Stage and commit resolved files
# Discard uncommitted changes
git checkout -- filename
# Reset to last commit
git reset --hard HEAD
# Reset to upstream main
git reset --hard upstream/mainYou've successfully completed this exercise when you:
- Forked this repository
- Cloned your fork locally
- Configured upstream remote
- Created a feature branch
- Added yourself to contributors.yaml
- Committed and pushed your changes
- Created a Pull Request
- Successfully merged your PR (instructor will merge)
Happy Coding! 🚀
This repository is maintained for educational purposes as part of the Full Stack Developer Course - Batch 18