If you’re new to development, the idea of version control may seem like a scary topic. All those terminal commands… But don’t let the command line interface scare you away. When I started freelancing, the most popular version control system that’s used today,
git, hadn’t even been invented!
While the world of version control may seem vast, you can learn 95% of the commands that you’ll need each day in a few minutes.
Guide to Version Control
So what is version control? It’s a pretty explicit name. To put it simply version control gives you the ability to designate specific versions for your code projects.
So the best way to think about it is that each new feature of your application should have its own version.
This gives you the ability to designate specific points in time where features were deployed to your application. Some examples of versions could be:
- Integrated authentication to allow for user registration, sign in and log out features.
- Built out permission structure to block non admin users from management dashboard.
There are a number of version control systems on the market. However the top choice for most developers is
git version control system was created in 2005 by Linus Torvalds, the creator of Linux.
At a high level
git gives developers a clean interface for managing versions of codebases.
A World Without Version Control
In a world without version control life would be pretty frustrating. I remember back when I started building programs without version control. Each time I made a significant change I’d have to create a duplicate code file in case the change I made broke the site and I had to quickly switch back to the old implementation.
This approach to development was clunky and was lead to fragile applications. After I learned about version control it opened a completely new world to me and I haven’t looked back. When you use version control properly it will allow you to feel more confident with your development because you’ll know that you can always revert back to an old version if you make a mistake.
Surfing and Version Control
When I started integrating version control into my projects it reminded me of when I learned how to surf. When I first learned how to surf I simply jumped into the waves with a surf board. Every time I crashed I freaked out because the surf board would float away and I would have to furiously swim after it.
However after a few times on the water I noticed that all of the other surfers has straps that connected their ankles to the board. After I bought one of the straps I never had to worry about the board floating away because I could always bring it back with a tug.
You can think of version control as your surf board ankle strap. No matter what change you make in your project, you’re always only a few commands away from reverting back to a working version. This type of capability should make you feel more confident when it comes to building new features
Terms to Know
Some of the key terms to know when it comes to understanding version control are:
- Master Branch – The master branch is the code branch that is considered the
livebranch. You shouldn’t push to the live branch until your feature is ready for the public to see it.
- Development Branch – You also have the ability to create development branches. These branches allow you to build full features that you can create outside of the view of end users.
- Commit – A
commitdescribes the work that you do on specific features. Commits can be smaller than branches. For example, a branch called
permission structurecan have multiple commit messages, such as:
- Installed code library to manage application permissions.
- Built custom rules for guest users
- Blocked non admin users from editing accounts
- Merge – After you have built a full feature you can
mergea development branch into the master branch. After deploying this will allow users to use the new feature.
- Add – After you have performed work you need to
addeach of the changes into version control so it knows what changes to include in the version update.
- git ignore – You have the ability ignore any files that you don’t want checked into version control. This is important because certain files, such as any files that contain API credentials should not be pushed to version control.
How to Use GitHub
Here is a 25 minutes guide that will walk you through how to use Git, including:
- Building a project from scratch
- Using commit messages
- Working with a remote GitHub
- Creating git development branches
GitHub Isn’t Git!
As a side note, please don’t confuse
GitHub website is a great service that allows developers to remotely manage code projects. And it integrates nicely with
git. However they are completely separate entities.
Remote Version Control Options
When it comes to working with centrally located
git systems the two services I use the most are GitHub and BitBucket. Both services offer similar features. However I personally prefer GitHub simply due to its clean interface and the fact I’m more comfortable with using it.
Summary Guide to Version Control
I hope that this has been a helpful guide to
git and that you feel ready to start implementing it into your application.