Signup/Sign In

GIT: Using Github

There a lot of options available that allow you to host your repositories. If you are well versed with system administration, you can host them yourselves. If not, there are a lot of services available that take care of hosting for free, if you are okay with your repositories being public, for example, Bitbucket, CloudForge, Assembla etc. The most popular of these services is GitHub.

GitHub has a user base of millions of developers and provides excellent tools to manage your projects. Go to GitHub and set up your account. Once you sign up, GitHub provides you with a tour of all the features they have to offer

GITHUB

We recommend you go through the tour to understand GitHub better. You can search for repositories, for example go on and type "Linux" in the search bar. The first result is the Linux kernel source tree. The little graph behind it indicates how often people have been committing to the repository over time. Let's go take a look at this page.

GITHUB

We see a brief description of the project as well as some statistics about the repository. The Linux repository has seen over half a million commits and 452 releases over time. That is massive!

GITHUB

If GitHub didn't make this information available easily, we'd have had to clone a copy of the repository down to our computer in order to be able to find out how active of a project GitHub is, what kind of project it is to begin with, what the code currently looks like, or any number of other questions we might have.Since they're hosting in on GitHub though, we can find all of that information from our web browser.

There are some other nice features that GitHub provides as well. Some projects get their own issue tracker. If we click on the issues tab of the page, we can see where people have been filing bugs and asking questions about the said project. If you're not familiar with an issue tracker, it provides people with a great place to raise and discuss issues about the project in question and usually provides tools to help the project maintainers work through those problems efficiently.

Pull requests are an interesting concept that originated at GitHub. Remember that in GitHub, pulling code means that we merge changes in from a remote repository. Following this logic, a pull request is what you use when you have code that you want someone to pull into their project. This is a really useful tool for collaboration.

Let's stop and think about our awesome_project. It's not nearly as active as Linux, but we would still like to publish it on GitHub. Up in the top corner we can see a create new repo button. For the name, we'll just use awesome project for now. Provide a description if you want. This repository will be public since we are on a free account.

That's okay, we want to share our repository with you guys anyway! GitHub provides some help in creating a brand new repository. But since we have our own repository we need to do only the last two steps. We need to add GitHub as a remote, and we need to push our changes up.

Let's go ahead and do that:

$ git remote add origin https://github.com/joshvarun/awesome_project.git
$ git push -u origin master

GITHUB

We'll run the lines that they say to run in the project. We'll need to provide our username and password. The push seems to have worked. We'll switch back over to GitHub, refresh the page, and we have our project history. You can see that over the course of the project we made 11 commits.

GITHUB

Many hosting services like GitHub provide a well-featured interface to help you manage and explore your project history. Several teams have come to rely on these services to help them work more effectively and efficiently together.