Summary - Fork
- Git course
- Intermediate
- Lesson 56/82
- 5 min
Combine the fork flow to set up an open source contribution flow.
Summary - Fork Workflow
When contributing to an open-source project, first fork the original repository into your account. Clone your fork to create a local working copy. Add the original repository as upstream and use fetch to track updates.
Fork → Clone → Add upstream
→ Fetch → Prepare changesPractice Configure the Upstream Remote
After cloning your fork, write the command that adds the original project as upstream. The original repository URL must be https://github.com/original/sample-app.git.
Starter code
# Kaynak depoyu upstream adıyla ekleExpected output
Upstream remote added
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which command retrieves new commit information from the original repository?
- git init upstream
- git clone upstream
- git status upstream
- git fetch upstream Correct answer
Explanation: Use git fetch upstream to retrieve new commit information from the upstream remote.
2 Complete the Fork Contribution Workflow
git clone https://github.com/dev-user/sample-app.git
____
git fetch upstream
git clone https://github.com/dev-user/sample-app.git
git remote add upstream https://github.com/original/sample-app.git
git fetch upstream
Explanation: First, clone the fork, then add the original repository URL under the upstream name. The next fetch operation retrieves updates from that remote.
3 Match the Fork Workflow
| Term | Meaning |
|---|---|
Fork |
Copy the project into your account |
Clone |
Download the fork to your computer |
Upstream |
Remote connection to original repo |
Fetch |
Retrieve updates from original repo |