How to fork a repository on GitHub?
What is a fork?
A fork is a copy of a Git repository. Forking a repository allows you to collaborate on others project. It makes easy to work as a team on a project. Sometimes, fork allows you to use someone else’s project as a starting point for your own work.
How to fork a repository?
Log on to the GitHub Dashboard.
Navigate to the repository that you want to fork.
In the top-right corner, click on the Fork button.
Workflow
The simple and common workflow is described as below:
You fork the repository.
Create a local clone of the forked repository on your local machine.Open git and type the following git command to clone
$ git clone https://github.com/<your username>/<repository name>
Note: remove placeholders < , > in the command you issue.
Work on a feature/ change/ fix a bug to the project.
Example:
$ git checkout -b feature/new-service master
Push your changes.
Example:
$ git push -u origin feature/new-service
Submit a pull request to the project owner.
Project owner reviews the work, if everything looks good, the pull request would be accepted. The feature/change/ bug fix would be pulled into the upstream or the original repository.
Example
$ git checkout master
$ git pull upstream master
Rebase with master
Example
$ git checkout bug-fix-branch
$ git rebase master