Đoạn xem trước bài giảng

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.

fork pull request code review
Bạn sẽ học gì trong bài giảng này
  • 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.

Phần đầu bài giảng

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.

Bài giảng đầy đủ dành cho thuê bao

Còn 30 slide nữa trong phiên bản đầy đủ.

Video, toàn bộ slide, ghi chú, bài kiểm tra, gia sư AI và phỏng vấn sẽ mở sau khi đăng nhập và đăng ký thuê bao.

Đăng nhập hoặc đăng ký Đăng ký thuê bao

Nội dung bài giảng

  1. Forks: Your Personal Sandbox
  2. How to Create a Fork on GitHub
  3. Fork vs Cloning: What's the Difference?
  4. Cloning Your Fork to Your Computer
  5. Adding Upstream for Synchronization
  6. Checking Remote Repositories
  7. Why Do We Need Separate Branches?
  8. Creating a Feature Branch
  9. How to Name Branches Correctly
  10. The Importance of Atomic Commits
  11. Writing the Perfect Commit Message
  12. Common Commit Mistakes
  13. Why Publish a Forked Branch
  14. The git push Command for Publishing Branches
  15. Verifying a Published Branch
  16. Pull Request as a Change Proposal
  17. PR Title: Clear and Concise
  18. PR Description: What, Why, and How to Review
  19. Common PR Mistakes
  20. PR Monster: Why Large Pull Requests Kill Code Review
  21. PR Description: Your Chance to Explain, Not Apologise
  22. One PR, One Task: The Art of Keeping Changes Focused
  23. Code Review as a Dialogue with Your Editor
  24. Respond to Every Comment
  25. Commit Fixes Separately
  26. Why Merge Conflicts Occur
  27. Updating the Branch Before Merging
  28. Finding and Resolving Conflicts
  29. Completing Conflict Resolution
  30. Cleanup After a Successful Merge
  31. Deleting Feature Branches on GitHub
  32. Updating Your Local Repository
  33. Mastering Team Collaboration: From Fork to Merge

Bài viết liên quan đến bài học này

Tất cả bài giảng của khóa học

  1. Introduction: Git from Scratch to Confident Developer
  2. Why Git is Essential - And Why It's a Job Requirement
  3. Installation and Setup: Getting Git Ready for First Use
  4. First Repository: init, add, commit, and the Magic of the Index
  5. Reading History: log, diff, show and Navigating the Past
  6. Branches: The Parallel Reality of Your Code
  7. Undoing Mistakes: restore, reset, revert — Doing It Right and the Dangers
  8. GitHub and Remote Repositories: Your Code in the Cloud
  9. Team Collaboration: Forks, Feature Branches, and Pull Requests
  10. Merge Conflicts: Don't Panic - Understanding and Resolving Them
  11. Git Workflows in Real Teams: Choosing the Right Approach
  12. Advanced Tools: Rebase, Stash, Cherry-pick and Tags
  13. Final Project: Simulating Real Team Development