Welcome to the collaboration zone ๐ค โ where developers unite, contribute, and build amazing things together.
If Git helps you track your own code, GitHub helps you collaborate on everyoneโs code ๐.
Letโs go step-by-step from forking a repo to merging pull requests โ just like pros in open source projects. ๐ช
A fork is your personal copy of someone elseโs repo on GitHub.
Think of it like cloning your friendโs notes to add your own highlights. ๐
๐ก Pro Tip:
Forking is essential for open-source contributions โ it keeps your changes isolated and reviewable.
Before you start coding, create a branch to organize your changes.
Each branch should represent one feature or bug fix.
git checkout -b feature/add-login-page
This creates a new branch called feature/add-login-page and switches to it.
๐ก Branch Naming Convention:
| Type | Example |
|---|---|
| Feature | feature/add-dark-mode |
| Fix | fix/navbar-alignment |
| Docs | docs/update-readme |
| Chore | chore/dependency-updates |
โ Keeps your repo clean and understandable for teams.
Now, modify your code or documentation.
Once done:
git add .
git commit -m "Add login page with responsive layout"
๐ก Commit Tips:
Use present tense (โAdd featureโ, not โAdded featureโ)
Keep messages short but meaningful
Reference issue numbers if applicable (e.g., #42)
๐ง Example:
โFix: resolve login API error on mobile (#42)โ
Once your commits are ready, push them to your forked repository:
git push origin feature/add-login-page
This uploads your feature branch to GitHub.
๐ก If itโs your first push:
git push -u origin feature/add-login-page
Now, head to GitHub โ youโll see a prompt like:
โCompare & pull requestโ
Thatโs your next step ๐
A Pull Request (PR) is how you propose changes to a project.
Youโre basically saying, โHey, I made some improvements โ please review and merge!โ
Go to your forked repo on GitHub
Click Compare & pull request
Add:
A clear title: Add responsive login page
A short description of changes
Choose:
Base Repository: The original project
Base Branch: Usually main or dev
Head Branch: Your feature branch
Click Create Pull Request โ
๐ฏ Example PR title:
โโจ Add responsive login feature (mobile support)โ
Once submitted, maintainers or teammates will review your PR.
๐งฉ Code feedback & suggestions
๐งช Automated checks (CI/CD, tests)
๐ง Discussions or design notes
When approved:
Maintainer clicks Merge Pull Request
Changes become part of the main branch ๐
Sync your local main branch:
git checkout main
git pull origin main
Every big open-source repo has a CONTRIBUTING.md file that explains how to contribute effectively.
Hereโs what you should include in yours ๐
# Contributing Guidelines
1. Fork the repository ๐ด
2. Clone your fork:
git clone https://github.com/<your-username>/<repo-name>.git
3. Create a feature branch:
git checkout -b feature/your-feature
4. Commit your changes:
git commit -m "Add your awesome feature"
5. Push to your fork:
git push origin feature/your-feature
6. Submit a Pull Request ๐
๐ก Pro Tip: Add labels for first-time contributors like:
good first issue
help wanted
They attract newcomers and boost engagement ๐ฌ
Hereโs how a team project works in GitHub:
# Developer 1 creates feature
git checkout -b feature/add-payment
# Developer 2 fixes a bug
git checkout -b fix/api-timeout
# Both push their changes
git push origin feature/add-payment
git push origin fix/api-timeout
# Review & merge PRs into main
git checkout main
git pull origin main
Now everyone stays synced โ teamwork done right โ
A commit is you talking to yourself ๐ฃ๏ธ
A PR is you talking to your team ๐ฌ
A merge is your idea becoming part of the project ๐
| Habit | Why It Matters |
|---|---|
| Create branches per feature | Keeps history clean |
| Write meaningful commits | Easier reviews |
Sync (pull) before pushing |
Avoid conflicts |
| Respect code reviews | Builds trust |
| Use PR templates | Saves time for maintainers |
To standardize PRs, create a file:
.github/pull_request_template.md
## ๐งฉ Description
Briefly describe the changes and motivation.
## โ
Checklist
- [ ] Code tested
- [ ] Linting passed
- [ ] Documentation updated
## ๐ฌ Related Issues
Closes #issue_number
This ensures clean, consistent PRs for every contributor ๐งน
โ
You forked and cloned repos
โ
You created branches for features
โ
You pushed commits and opened PRs
โ
You learned how reviews and merges work
โ
You understood open-source contribution flow
| GitHub Action | Real-World Example |
|---|---|
| Fork Repo | Make a personal copy of a recipe ๐ด |
| Feature Branch | Add your twist to the recipe ๐ง |
| Pull Request | Submit your version for tasting ๐จโ๐ณ |
| Code Review | Friends give feedback ๐ฌ |
| Merge | Everyone agrees โ add it to the cookbook ๐ |
Youโll master:
rebase,stash,reset, andrevertโ the tools pros use to rewrite and clean history like time travelers. โณ
๐ Continue โ 06-Advanced-Git
โ๏ธ Written with ๐ by Mahesh Shukla โ building open-source confidence, one pull request at a time ๐