- How to fork a GitHub project
- Cloning a forked repository and its branches
- Updating a forked repository
Scenario 1: I want to fork a project on GitHub to work on a feature in my local repository.
Go to the prject page on GitHub, https://github.com/PROJECT_AUTHOR/PROJECT.git Click the "Fork" button The project will be added to your list of repositories
Scenario 2: The Github repository has a branch called “bananas”. I want to copy that branch in my local repository.
git fetch origin git checkout --track origin/bananas
Scenario 3: A day later, another branch called “cool-beans” was added to the original project. I want to add that branch in my local repository as well.
git remote add upstream https://github.com/PROJECT_AUTHOR/PROJECT.git git fetch upstream git checkout --track upstream/cool-beans