At some point in your coding journey, you'll come across certain development tools that'll help you keep your workflow in order. Things like package managers, preprocessors (like SASS or LESS for writing CSS). One important tool at your disposal is called version control, or a code management system.
As the name implies, version control systems (VCS) manage any changes you make to your code. You create an initial code base, or repository, and when you save your changes, the VCS keeps track of every little thing you modified. This is especially important for large projects with a bunch of developers working on it, but individual developers can make use of them too, as a means of documenting where and when you made changes if something goes wrong.
Git... like "get"?
Torvalds quipped about the name git (which means unpleasant person in British English slang): "I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'."
But also, the readme file of the source code has this explanation:
He described the tool as "the stupid content tracker"
and the name as (depending on your way):
- random three-letter combination that is pronounceable, and not
actually used by any common UNIX command. The fact that it is a
mispronunciation of "get" may or may not be relevant.
- stupid. contemptible and despicable. simple. Take your pick from the
dictionary of slang.
- "global information tracker": you're in a good mood, and it actually
works for you. Angels sing, and a light suddenly fills the room.
- "g-dd-mn idiotic truckload of sh*t": when it breaks
You can take your pick.
Linus created Git because the system they were using at the time was very slow - taking up to 30 seconds to make changes to the codebase. So he went with Git being a distributed system, rather than centralized. A few key things:
- by its namesake, a distributed system doesn't have a central, reference copy of code that you're making changes to. There's only working copies, meaning every developer has their own copy of the source.
- any operations that you make - commit code, view the change history, reverting any changes - is fast, because there's no server to communicate with; it's all done on your working copy.
- each working copy is pretty much a remote backup; it'll track all of the change-history, so if your codebase gets lost, you still have it.
This may or may not be easy to understand. Let me draw a little diagram for you.
Make sense? It might be clearer once you start using it. One way you might use it is to divvy up any new components or services you may be adding to an app or website - creating what are called branches on your remote copy. That way, you can bounce between them and you're not just working them all in one, keeping track of where you are on each. When you're done, you just merge the branch back into your main code.
So what is Git_Hub_?
You actually may have heard of GitHub before you even knew or understood what Git was. Basically, GitHub is your server. It's a web service built on Git where you can keep all of your source code; and since it's built on Git, you're able to see all the changes to the repository right in the browser. It also makes collaborating with other developers much easier, like keeping track of known issues and pull requests.
What's more, GitHub is also a social network. You can have a look at all the members and their public repositories, and even use some of them yourself in your own projects. A lot of businesses use GitHub as well, from Google to Microsoft, for their open-source projects. Another thing you'll see on user profiles are contributions they may have made to GitHub projects - it keeps track of that. So maybe you find a bug while you're using it: you can make a pull request once you've fixed it, and the owner of the repository can have a look at it, committing the changes to the source if everything checks out. It's pretty cool, and a good way to get your hands dirty. Did I mention it's free to sign up?
Using Git can be a bit confusing at first, but once you've got the hang of it, it'll be invaluable once you start to work on bigger and more complex projects. If you're job hunting, knowledge of version control is usually required - they may even name Git specifically. And GitHub, with its vast community and projects, will be a good resource for finding something you need for your own project, or just to play around with. You'll love it.
Where do I start with Git?
Check out the Git website to look at the documentation, and get an in-depth look at how Git works. At tryGit, you can go through some challenges learning how to use Git from the command line interface. GitHub also has a list of resources to get you started. And as always, Google is your friend. If you find something good, you should share it to #DatCode!