How to use GitHub like a Pro

 

Have you seen Infragistics' repositories on GitHub? Feel welcome to contribute and let’s build amazing code together!

Let’s begin today’s post with a fact: As of right now (at the time of writing), GitHub has 21 million repositories and 9 million users - which isn’t too bad at all! For developers, GitHub offers an enormous range of tools, Wikis and information, so we want to help show you how to use it like a pro.

Before understanding what GitHub is, the first thing to do is understand what Git is. Git is an open source version control developed by the founder of the Linux, Linus Trovalds. Like any other version control, Git manages and stores the different versions of a project.

GitHub is developed over the Git version control so that it brings your project on the web for social networking and shares your code with other developers, inviting them to extend or improve your code. It provides collaboration features like wikis, project information, version releases, contributors to the repository, open and closed issues and more. All this allows developers to easily download the new version of an application, make changes and upload it back to the repository.

Git is a command based tool to perform version controlling for the source code. It also provides a graphical user interface which lets you contribute to projects. You can download the desktop version of GitHub here.

Getting started with GitHub

Repository – Repository is a directory or storage space where all your project related files are stored. This can include source code files, user documentation or installation documentation; everything can be stored in the repository. Each project will have its own repository along with a unique URL on GitHub. You can create either a Public repository - which is free and open source - or a Private repository, which is a paid version.

To create a repository, Go to the Repository tab and click on ‘Create new repository’, where you can then fill in details like the Repository name and description.

Forking – The process of Forking a repository lets you create a copy of an original project as a repository in your GitHub account, allowing you to work locally on the source code. You can make changes to the source code (such as fixing bugs) and commit these to your repository.

In order to fork a repository, you can navigate to the repository URL and click on ‘fork the repository’ to create a repository in your local account.

Commit – Commit is when an individual makes changes to source code. Every time you save code it creates a unique ID to identify what changes to the files were submitted for the particular commit. It also takes up the title and description of the commit to specify what changes were made and what this commit signifies.

Once you have forked a repository, you can make changes in the file. Let’s make changes to the readme.md file. I have updated the readme.md file by adding a 2nd line as shown below.

To update this file, go to the ‘commit changes’ section located at the bottom of the file and update the title of the commit as well as the description:

Upon clicking the 'Propose File Change' changes will be committed in the new branch.

Pull Request - Once you are done with making changes, you can submit a ‘Pull Request’ to the original project owner. If your fix or changes are approved after testing, he/she can pull your changes in the original project. All Pull Requests are managed from the self-titled tab which shows every Pull Request submitted by each contributor. It will compare the updated source code with the original source code, and will provide the list of files that are changed and committed. The owner of the project will have a comprehensive view of all the updated changes in each file, along with the comparison view.

Once you’re done committing changes in the new branch, you’ll be taken to a Pull Request screen to generate the pull request for your new file changes.

Click on the Create ‘Pull Request’ button. A Pull Request will be created and will be visible to the project owner under the pull request section.

Merging Pull Request – Once the changes in the Pull Request are reviewed and approved, now is the time to merge the changes in the original source code. In order to merge the request into the original repository, you need to have a push access on the repository.

The project owner can select the submitted Pull Request and review any changes from the ‘Files Changed’ tab. Clicking on each file will show you what has been changed, added or deleted.

Once the project owner verifies and approves the changes, the new project is ready to merge into the original project.

Click on ‘Merge pull request’ to merge it into the original branch.

GitHub Visual Studio Extension

GitHub is a powerful open source version control, and provides many capabilities through both Git console and the GitHub Desktop Version. But, like every source control, it requires direct integration into your Developer tool. Fortunately, Microsoft and GitHub recently announced the availability of GitHub enterprise in Azure, and they have also launched the GitHub Visual Studio Extension, allowing developers to easily connect and work with GitHub Projects directly from Visual Studio. Team Explorer support for Git allows you to do commits, branching and conflict resolution. You can download the extension here.

Why GitHub?

GitHub is not just another version control to keep track of changes. Instead it is a distributed version control which allows users to share code with developers across the globe.

Other key benefits of GitHub include:

  • Support from the Open Source Community
  • A distributed Version Control system
  • Social Networking features like Wikis
  • Manage code with multiple options
  • Show off! If you’ve created something fancy, GitHub provides the easiest way to share it with the Open Source Community.

GitHub also offers social networking capabilities to help you increase your network so that your code can be updated by various developers. As the saying goes, many hands make light work, and for that reason alone you should be using it.

Create modern Web apps for any scenario with your favorite frameworks. Download Ignite UI today and experience the power of Infragistics jQuery controls.

 

 


Add a Comment

Be the first one to add a comment. Please Login or Register to add comment.