On the fourth day of Gitmas, my mentee asked of me...
what's this "GitHub" of which I've heard?
Git's ready - what then,
how do I get Git set up,
and could you explain Git, pretty please?
Today's Day 4 of the 12 Days of Gitmas, and today we're introducing you to GitHub!
What is GitHub?
GitHub is a web interface for your git repository, on the cloud. This means that once you create your repository on GitHub, you can go to your repository on the GitHub website, see your code, see all the past versions you've checked in, and share the link with other people so they can see it too.
Why do you use it?
When you use Git locally, you can track your own changes, but you're working by yourself. When you use a platform like GitHub, you can work on a project with other people, and have their changes tracked too. (Technically there are ways to host your own server and collaborate directly with others, but websites like GitHub make it much easier and do most of the dirty work for you.)
If you're working on a project for a company, or something open source, you'll use something like GitHub in order to all be able to work together, so everyone can make changes to the codebase and have everyone else be able to see and use it.
In addition, platforms like GitHub host your code for you - so if something happens to your computer or you accidentally delete your local version of your repository, you can still go back to the repository on GitHub and download your code again. In a way, GitHub keeps a remote backup of what you're working on, so long as you have checked your code in (in other words, "saved" your code changes to GitHub).
What are the alternatives?
BitBucket, GitLab, and Beanstalk are a few of the many alternatives to GitHub. While GitHub is still the most popular, many companies or groups will choose other options due to cost, features, or ethical reasons.
While there are some differences, most of the content in this series can be applied interchangeably to any of the different version control platforms that use Git.
How do you set GitHub up?
First things first, if you don't already have one, sign up for an account. It's a good idea to use the same email address you used when you set up git config
in Day 2 of this series.
Regardless of whether you initialized a local repository or not after the last post, you'll need to create a new repository on GitHub. If you initialized a repository locally, then use the same repository name when you create a repository on GitHub, so you can link them up without issue.
If you do not have a local repository yet, then call your new project whatever you'd like. You can also check the Initialize this repository with a README
box - this will ensure that your project will start out with a file inside it. (You should NOT do this if you plan to link up your new GitHub repository with an existing repository already on your computer.)
Now you have a repository on GitHub! But how do you link up your GitHub repository to the one on your computer? And what the heck is SSH? We'll go into all this and more on Day 5 of the 12 Days of Gitmas!
If you have any questions about Git or requests for other topics you'd like to see me blog about, please leave a comment! And if you're enjoying this series, consider supporting me on Patreon, following me on Twitter or checking out my Twitch streams!
Top comments (1)
Please cover Git merge, rebase and resolving got conflicts, or any other more advanced topics, i.e submodule, Git Flow.