How to Co-work with Git on SourceForge and Github

Basic Steps:

  1. Login to Github or SourceForge to fork (not clone) a project.
  2. Clone the forked project from your remote repo to your local disk.
  3. Coding and commit changes to your local repo.
  4. Push your changes to your remote repo.
  5. Send a merge request to the project owner.
  6. The project owner can finally finish the merge work after receiving the request.

SourceForge

I will show you the example about how to let multi-contributors collaborate for the MergeHero project, which is shown as below.

MergeHero

  • Visit the MergeHero homepage, and switch to the code repository. If you are not the project owner, you will not have the RW permission.
  • To get the RW permission and contribute your code, click Fork.
  • Now, you have obtained the RW permission. Use git command to create a local clone of the remote project.
  • Add and commit your changes locally.
  • Push changes to the remote repo with the following command: git push origin master.
  • It’s ready to send the merge request (there is a button on the SourceForge page) to the project owner.
  • The project owner will receive the notification with a request link, like https://sourceforge.net/p/mergehero/code/merge-requests/4/.
  • Open the link, you can see the commands for merging the source code.

merge

  • Execute these commands, and push the changes to the remote repo:
git checkout master
git fetch git://git.code.sf.net/u/adambj/mergehero master
git merge 7225ea95305924737e4f299987235328f5336d9a
git push origin master

Github

It’s similar on Github. Let’s glance at Dynamic .NET TWAIN SDK. There is a Fork button located at the top-right corner.

Dynamic .NET TWAIN github

  • Click Fork to get a copy of repository for yourself.
  • Here are some same steps: clone repo, write code and commit changes.
  • To send a merge request on Github, it’s a little bit different. Click Pull Requests.

pull request

  • Create and send the request to notify the project owner via email.
  • Open the link to merge the code:

Github merge

  • Click Merge pull request to finish the merge work.

With Github, you can compare and review the source code, and do the merge work directly on the server side. Pretty convenient! If you have any questions, please feel free to contact me at {desmond at Dynamsoft dot com}.