At the start of last year, I had no freaking idea what the hell “Github” was. Words like “repository” and “source control” were foreign to me, and I’m not afraid to admit it. In this article, I’ll help you understand Github, in a way you’ve never heard before.
So really, what the hell is Github?
I wish someone broke it down like I am today, so listen up. At it’s most basic level, Github is free cloud storage. Yep, that’s it in a nutshell. Hardcore coders would get mad at me right about now, because Github can do a whole lot more than that. It also helps you keep track of your changes, and manage code changes between your team. Let me break those three things down in more detail.
At it’s most basic level, Github is free cloud storage. Yep, that’s it in a nutshell.
1. Cloud storage
When you sign up for Github, you will create your first “repository.” This is nothing more than a folder in the cloud, hosted on Github servers.
You can make changes to this code on Github’s actual website, but you want to use a real text editor like Sublime. So instead, download the free Github for Mac application. You’ll clone that “repository” to any location on your computer. I like to keep my repositories in a folder on the desktop titled “Github,” for easy access.
At this point, you could theoretically put anything you want in that “repository’s” folder, including PSDs, but it is geared for code files like HTML and CSS. What ever changes you make to the files (including deleting, renaming, adding) will be tracked, which takes us to feature number two.
2. Keeping track of your changes
As I said earlier, you’ll want to have a desktop application, like Github for Mac, to track your changes. If not, you’ll have to push it with code, which sounds boring and sucks! I’m going to use the analogy of a gun for these purposes. Please, don’t get political about it.
- 1. Load the magazine / Pressing save
- Every time you change a line of code and press “save,” it is tracked, or put in the magazine. This happens in the background, so you don’t have to worry about it.
- 2. Cock the gun / Commuting your changes
- You can periodically “commit” those changes in the Github for Mac App, which basically loads the gun.
- 3. Fire / Pushing your changes
- You can “push” or “sync” your changes, which puts them up in the cloud.
The cool thing is you can always revert back changes again and again, in case you mess up.
3. Team management
Because you’re working off the cloud, everyone always has the latest copy of the website “cloned” on their MacBooks. It doesn’t happen automatically, which is why, periodically, they need to “pull” / “sync” their files. It’s good practice to do this every morning before you start working.
Adding your coworker’s code to yours is simple. But what if your coworker deletes some of your code? No worries. The Github app will help manage code discrepancies.
There are Github alternatives
The problem with Github is that you “repositories” are public. They are freely searchable, and indexed by Google. You can pay for private “repositories,” but why would you? Bitbucket is a competitor to Github, and it gives you free private repositories. I’ll cover Bitbucket in a future blog post.
That being said, start with Github, it’s the most popular. I’d start with that, get the hang of it, and progress onto others. I hope I’ve given you the lowdown of the basic of Github. Let me know what you think in the comments below.