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}.

Using Git-TFS in Visual Studio 2013 Express

Microsoft has released Visual Studio 2013 Preview, and announced the availability of Git for Visual Studio and Team Foundation Service. Today, let’s go through the new experience of version control in VS 2013 Preview.

Account Creation

Microsoft provides Team Foundation Service Free Plan for up to 5 users. I’m using the service for demo in this article. If you don’t have an in-house TFS Server, you can also take advantage of it and sign up for an account here. If you need a TFS Hosting service with good customer service, you may check out Dynamsoft TFS Hosting plans.

After creating an account with Microsoft TFS Service, you will be directed to your TFS page like the one shown below. You can see two options for creating a team project. The account URL is located below “Getting started”.

TFS main page

Team Project Creation

Click “New team project + Git” to create a team project using Git as the source control provider.

create git project

 

Specify the project name and select Git for version control.

specify new project

 

This is the page for my newly created team project. After creating the team project, we can then push the local repo to remote server.

project created

Local Project Creation

Create a new project in Visual Studio, and do not forget to check “Add to source control”.

create local project

 

Choose Git as your source control system.

choose git

 

Now you will be able to view the changes of your source code.

changes of source code

 

Commit your code.

commit changes

 

Right click a file in Team Explorer, you can compare version differences with syntax highlighting.

diff files

 

Also, checking repo history is convenient by right click.

view history

Publish to Remote Repository

Switch to Commits.

switch to Commits

 

Find Git URL on your TFS account.

git URL

 

Copy the URL to remote repository configuration, and click “Publish” to upload your local files to remote server.

publish to remote repo

 

Check commits information online.

commit log

 

Import Git from GitHub

Clone Git repo.

git clone

 

Download source code to local disk.

clone finished

 

Double-click your repo and click “Open” to mount your project.

open cloned project

 

That’s all about how to simply use Git between Visual Studio 2013 Express and Git remote server. Don’t hesitate to email kgao@dynamsoft.com if you have any idea to share with me.