Fork and pull model refers to a distributed software development model mostly used on Github, where multiple developers working on a open online project, make their own contributions by cloning a main repository on local repositories and pushing changes after creating pull request first for other users to review and comment. Followed by the appearance of distributed version control systems (DVCS), pull-based development model was naturally developed by Git after various other code integration methods[1]. Ever since its appearance, pull-based development received large popularity within the open software development community. On Github only, about more than 400,000 pull-requests emerged per month on average in 2015[2]. It is also a model shared on most online code collaboration platforms, like BitBucket, Gitorious etc. More and more functionalities are added to facilitate pull-based model[2] these days, including social media features, popular repositories code watching and reviewing et al.

Reasons

edit

There are a few motivations for programmers to use fork and pull request methods.

Fork: When developers need to make contribution to existing projects, such as adding new functions or corrections, they need a temporary experimental development environment to verify code qualities and make changes until it is accepted by the administrator of the project. Also, due to divergence on important issues, developers may want to have their own branch to develop.[3]

Pull request: Administrators of the projects decide whether the forks could be accepted to merge into the main branch by handle pull request. Accepted pull request represents quality and agreement among main developers which ensures successful cooperation on the same project.[4]

Procedures

edit

Specifically speaking, fork mainly means copy a repository from other users from Github onto your own project[5]. Pull request help you notify other collaborators on the same project with the changes you made to a repository, also with follow-up review and comment functions[6].

This is the process of forking a repository and pulling a request.

1. Fork a existing repo

After creating an account on Github, you can fork any public repository simply by clicking the fork button.

2. Clone to local repo

After forking the main repository, you can clone it onto your own repository. First, click the clone or download button from your Github account. Then in your own terminal, you should type in the code below to clone the repository onto your own computer.

$ git clone https://github.com/YOUR-USERNAME/PROJECT-NAME

After typing the enter, you local repository will be added.

3. Adding a remote

$ git remote add upstream ORIGINAL DEPOSITORY ADDRESS

4. Keeping up to date

After you set up the remote, you may always keep you local repository up to date, by using the command below,

$ git fetch upstream
$ git checkout master 
$ git merge upstream/master

This is a regular procedure when you feel not reading pushing up your changes online, but still want updates from resource code in order to prevent uploading anything duplicated.

5. Making changes

You can push the changes you made in new branch on the original repository by typing:

$ git checkout master
$ git branch NEWFEATURE
$ git checkout NEWFEATURE

The NEWFEATURE branch is where you make new changes you want to push onto the upstream code.

6. Pushing changes

After you have committed your work to the local branches, you should synchronize the GitHub by pushing.

$ git push origin NEWFEATURE

7. Pull request

After you pushing the changes on Github, it will ask you to make a pull request, or you can find the pull request button on the workplace for your account on GitHub.

8. Cleaning up

If the integrator has accepted and merged your work into the main branch, you can clean up your works.

$ git pull upstream master
$ git branch -d <branch name>

Challenges

edit

Despite its popular usage, fork and pull model face certain challenges for its future development.

Technical challenges: To ensure the quality of project, administrators have to be responsible for the code reviewing. More pull requests will bring more complex errors and uncertainties. Situations will get worse when there are not enough reviewers.[1]

Social challenges: Copious pull requests bring administrators trouble of handling and prioritizing.[7] Furthermore, explaining rejection as well as asking for more work from contributors which may breed discontent are also big challenges for administrators.[1]

Some studies are specially concerned about the troubles facing from the contributors and the integrator using the pull and fork model. The motivation from the contributors to generate pull request and the rationale from the integrator to manage pull request merges are two pivotal factors for usage of the model, however they are also the get the most criticisms[1][7].

References

edit

There are a few comprehensive tutorials towards the usages of fork and pull model.

  1. ^ a b c d Gousios, Georgios; Zaidman, Andy; Storey, Margaret-Anne; van Deursen, Arie (2015-01-01). "Work Practices and Challenges in Pull-based Development: The Integrator's Perspective". Proceedings of the 37th International Conference on Software Engineering - Volume 1. ICSE '15. Piscataway, NJ, USA: IEEE Press: 358–368. ISBN 9781479919345.
  2. ^ a b YUE, YU (July 18, 2016). "Determinants of pull-based development in the context of continuous integration". Science China Information Sciences. 59 (8). doi:10.1007/s11432-016-5595-8. Retrieved 1 August 2016.
  3. ^ Nyman, Linus; Mikkonen, Tommi; Lindman, Juho; Fougère, Martin (2012-09-10). Hammouda, Imed; Lundell, Björn; Mikkonen, Tommi; Scacchi, Walt (eds.). Open Source Systems: Long-Term Sustainability. IFIP Advances in Information and Communication Technology. Springer Berlin Heidelberg. pp. 274–279. doi:10.1007/978-3-642-33442-9_21. ISBN 9783642334412.
  4. ^ Gousios, Georgios; Pinzger, Martin; Deursen, Arie van (2014-01-01). "An Exploratory Study of the Pull-based Software Development Model". Proceedings of the 36th International Conference on Software Engineering. ICSE 2014. New York, NY, USA: ACM: 345–355. doi:10.1145/2568225.2568260. ISBN 9781450327565.
  5. ^ "Fork A Repo - User Documentation". help.github.com. Retrieved 2016-09-10.
  6. ^ "About pull requests - User Documentation". help.github.com. Retrieved 2016-09-10.
  7. ^ a b Gousios, Georgios; Storey, Margaret-Anne; Bacchelli, Alberto (2016-01-01). "Work Practices and Challenges in Pull-based Development: The Contributor's Perspective". Proceedings of the 38th International Conference on Software Engineering. ICSE '16. New York, NY, USA: ACM: 285–296. doi:10.1145/2884781.2884826. ISBN 9781450339001.