Team Collaboration: Forks, Feature Branches, and Pull Requests
This section covers the workflow used by 90% of open-source and corporate teams. We'll go through the complete cycle: fork → feature branch → commits → pull request → code review → merge. We'll specifically examine how to write PR descriptions that give reviewers immediate context, and which common PR mistakes immediately identify a newcomer.
- You'll be able to contribute to any open-source project using the standard fork → PR workflow.
- You'll learn how to format pull requests so reviewers understand the task without additional questions.
- You'll understand how to properly respond to code review feedback — both technically and communicatively.
จุดเริ่มต้นของบทเรียน
Forks: Your Personal Sandbox
- A fork is your personal copy of a repository on GitHub
- Complete control without risking the original
- Maintains connection to the source project
- Perfect for experimentation and open source contributions
Imagine finding an interesting book in the British Library, but you can't make any notes in it. A fork solves this problem by creating your personal copy of the repository on GitHub. Now you can experiment with the code without risking damage to the original project. This is particularly useful when you need to test an idea or contribute to someone else's project. Your fork remains connected to the original repository, making it easy to track updates and send changes back to the author.
How to Create a Fork on GitHub
- Click the Fork button in the top-right corner
- Select your account as the destination
- Wait for the copy to be created
- Clone your fork to your local machine
Open the desired repository on GitHub and find the 'Fork' button in the top-right corner. After clicking, select your account as the destination. Within seconds, GitHub will create an exact copy of the repository in your profile. Now you can clone it to your computer using the git clone command and start working. Make sure you're cloning your fork, not the original repository.
# Cloning your fork to your computer
git clone https://github.com/your-username/repository.git
# Changing to the project directory
cd repository
# Checking remote repositories
git remote -v
Fork vs Cloning: What's the Difference?
- Cloning: A local copy on your computer
- Fork: A remote copy in your GitHub account
- Fork maintains a connection to the original repository
- Convenient for syncing changes
While both processes create a copy of the repository, there's a fundamental difference between them. Cloning downloads the code to your computer, while forking creates a remote copy in your GitHub account. A fork maintains a connection to the original project, making it easy to synchronize changes. This is a key point when contributing to open-source projects: you work in your own fork and then propose changes to the author via a pull request. Now that you've created your copy of the project, it's time to bring it to your local machine and learn how to work with it.
บทเรียนฉบับเต็มใช้ได้เมื่อสมัครสมาชิก
ฉบับเต็มมีสไลด์เพิ่มอีก 30 สไลด์
วิดีโอ สไลด์ทั้งหมด โน้ต แบบทดสอบ AI ติวเตอร์ และการสัมภาษณ์จะเปิดหลังเข้าสู่ระบบและสมัครสมาชิก
เข้าสู่ระบบหรือลงทะเบียน สมัครสมาชิกเนื้อหาบทเรียน
- Forks: Your Personal Sandbox
- How to Create a Fork on GitHub
- Fork vs Cloning: What's the Difference?
- Cloning Your Fork to Your Computer
- Adding Upstream for Synchronization
- Checking Remote Repositories
- Why Do We Need Separate Branches?
- Creating a Feature Branch
- How to Name Branches Correctly
- The Importance of Atomic Commits
- Writing the Perfect Commit Message
- Common Commit Mistakes
- Why Publish a Forked Branch
- The git push Command for Publishing Branches
- Verifying a Published Branch
- Pull Request as a Change Proposal
- PR Title: Clear and Concise
- PR Description: What, Why, and How to Review
- Common PR Mistakes
- PR Monster: Why Large Pull Requests Kill Code Review
- PR Description: Your Chance to Explain, Not Apologise
- One PR, One Task: The Art of Keeping Changes Focused
- Code Review as a Dialogue with Your Editor
- Respond to Every Comment
- Commit Fixes Separately
- Why Merge Conflicts Occur
- Updating the Branch Before Merging
- Finding and Resolving Conflicts
- Completing Conflict Resolution
- Cleanup After a Successful Merge
- Deleting Feature Branches on GitHub
- Updating Your Local Repository
- Mastering Team Collaboration: From Fork to Merge
บทความเกี่ยวกับบทเรียนนี้
- Git และ GitHub: ต่างกันอย่างไร และเชื่อมโยงกันอย่างไร
- วิธีติดตั้ง Git บน Windows, macOS และ Linux
- Git คืออะไร และนักพัฒนาต้องใช้เพื่ออะไร
- Git Bash: คืออะไร และใช้งานบน Windows อย่างไร
- git fetch และ git pull: ต่างกันอย่างไร และควรเลือกอะไร
บทเรียนทั้งหมดในคอร์สนี้
- Introduction: Git from Scratch to Confident Developer
- Why Git is Essential - And Why It's a Job Requirement
- Installation and Setup: Getting Git Ready for First Use
- First Repository: init, add, commit, and the Magic of the Index
- Reading History: log, diff, show and Navigating the Past
- Branches: The Parallel Reality of Your Code
- Undoing Mistakes: restore, reset, revert — Doing It Right and the Dangers
- GitHub and Remote Repositories: Your Code in the Cloud
- Team Collaboration: Forks, Feature Branches, and Pull Requests
- Merge Conflicts: Don't Panic - Understanding and Resolving Them
- Git Workflows in Real Teams: Choosing the Right Approach
- Advanced Tools: Rebase, Stash, Cherry-pick and Tags
- Final Project: Simulating Real Team Development