If you’re a fresher or developer in Computers or IT field, chances are you must have come across this word more than once. Geeks can’t stop raving about it, developers can’t stop using it, some companies even list Github as a requirement in their ads. So what is this GitHub and why as a computer fresher you should know about it?
To understand GitHub we need to first understand what Git is. So let’s have a look at Git.
What is Git?
Git is an open source version control system, started by none other than Linus Torvalds. Yes, the same guy who started the idea of open source, the same guy who created Linux. But what is Version Control System?
Well, when you start your own project, writes thousands of lines of code and launch it, you need to keep updating your project. The next version has the updated code. When you develop something and you make changes, you release it with the next version, and Version Control system keeps a track of all of this and stores it in a common repository. Git is a command line tool, that ensures file integrity is not compromised and keeps a neat track of the earlier versions.
What is GitHub?
Wikipedia says:
GitHub is a web-based Git repository hosting service, which offers all the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.
GitHub is basically a code sharing website, where you create a repository and then add codes in it. Repository is a collection of well written codes which are always available. You can make your repository public or keep it private. Since it is open source project, anyone can view and download your code.
GitHub combines Git with a common Repository for everyone. Sp you’re creating a new project, saving it in a repository which is available to all and then updating it periodically, and the updated version is then available to all.
A team of 2 or more developers can use GitHub to share and update their code within themselves. The various features in GitHub helps developers to work together. Lets look at some of the common terms you need to know while using GitHub.
Repository:
Commonly known as repo, Repository is the place where all you code of your project will be saved. You can think of it as a common storage place for all the files related to that project. You can download the whole repository in zip or you can Clone it in your desktop, both the options are available at the right side of the repository.
Push:
GitHub doesn’t provide an IDE. You cannot go on the website to write code. It is a code sharing website so you need to install Git extensions in your IDE (Eclipse or NetBeans or Visual Studio) and configure it to use it with GitHub. Configuration is an easy task. You just need to give your login details and then give the repository name. When you’re done with your code, you can commit (we’ll see this in few minutes) it with a message and then PUSH it. Push here means sending the code in your IDE to the repository in your GitHub. The files that were modified (if you made some changes after you pushed your code) will be displayed by the IDE. Developer can then put commit message and send the code or updated code to the repo.
Commit:
When you want to push any code on GitHub, it’s a good practice to use a commit message. As we saw earlier, GitHub is open source project which is why everyone can see your repositories if you allow them to. A commit message will help the other developers understand what changes have you done to your code. Although it’s not mandatory but it surely is a good practice to add a commit message.
Fork:
The most fundamental idea behind Open Source project is to share it so people can view it, change it and make it better. Suppose you come across a repo which is good. But you think you can make it great by adding some features of your own, then you can fork that repo. What you’re doing basically is creating a new project from an existing one. You can then easily release the new repo as an updated version of the existing one.
Pull:
So you find a repo, and you think you can make it better, but you want to collaborate with the original author then you can then send a pull request. If the developer thinks accepts your request, you can pull the code, modify it and get yourself recognized as a contributor.
What made GitHub so popular?
Well earlier if you wanted to change an open source application, you would need to download the source code, make the intended changes, create and keep a list of the changes made, then send to the maintainer. The maintainer will then look at the new code sent by someone somewhere and will decide if they would like to merge with the stranger.
In GitHub, you can see the profile of the developer who wants to contribute, you can look at his codebase, his contributions in other projects and then take your decision.
When a team of 4 is working on one project, the team leader an add other 3 developers as contributors and then start the project. If one developer pushes a code, the second one can pull it, add his own code and push it to the repo with a commit message stating the new code he added. Third developer can then see what the first two have done, pull the updated code, add his codebase and push it back again to the repo. The team can easily work and collaborate. This is why geeks and developers just love GitHub.
GitHub makes a developers life easier. If you still haven’t tried it, go and explore.