DEV Community

Ilo Calistus
Ilo Calistus

Posted on

Why You Should Use A Version Control System (Git) For Your Projects

Version control is a system that saves changes to a file or set off files over time so that you can recall specific versions later.
In other words, version control makes it easy for you to store different versions of your project in a particular point of time. You can also restore previous versions and compare different versions.
They are different types of version control systems but in this article, I will be focusing on Git.

Why Git?

By far, the most widely used modern version control system in the world today is Git. Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel. A staggering number of software projects rely on Git for version control, including commercial projects as well as open source. Developers who have worked with Git are well represented in the pool of available software development talent and it works well on a wide range of operating systems and IDEs (Integrated Development Environments).

Basic reasons why you should use a VCS

Collaboration: A lot of big software projects require the effort of more than one programmer. who might be working from different angles of an office space or even different geographical location. Without a VCS, you are probably going to be calling your colleague over phone or pinging him telling him that you are working on module ‘XYZ’ ; and when you are done, you will probably zip and send your work(may be via email or another FTP).

  1. Office Collaboration With a VCS, everybody on the team is able to work absolutely freely – on any file at any time. The VCS will later allow you to merge all the changes into a common version.
  2. Storing versions properly: A version control system acknowledges that there is only one project. Therefore, there’s only the one version on your disk that you’re currently working on. Everything else – all the past versions and variants – are neatly packed up inside the VCS. When you need it, you can request any version at any time and you’ll have a snapshot of the complete project right at hand
  3. Restoring previous versions: Knowing that you can easily undo a changes on a project you are working on helps you to easily try out new ways implementation.
  4. Understanding what a particular project module does: When a project is well versioned with proper commit messages, it makes it easy for other team members or a new developer to pickup from where you stopped and progress or optimize the code with less hassle.

Common git terminologies and it’s meaning

Clone: This simply, means to download.
Repository(Repo in short): A repository is just a project folder.
Fork: This simply means to copy from the original repository to your own github, bitbucket, gitlab or whatever account.
Pull: This means to download latest changes from a repo.
Push: means upload your local changes.
Branch: see it like a copy of your original code but with a particular distinction.
Master branch: this is usually the main branch of every projects. Most company keep their production code on the master branch

Some basic git operations you should know

git clone .git : This used to clone a repository
git branch: Used to know the particular branch you are currently working on
git status: The status of the repo
git add: used to add an untracked file to git.
git commit -m” : used to save a particular work done locally on git. When a file has been committed, it is ready to be pushed. You cannot commit when you have not added a file
git push: Used to upload changes local changes to a remote repo. You cannot push a file when you have not committed
git log: view history
git pull: used to download updates from a remote repository
git branch : create a new branch
git checkout : Move to another branch
git merge : merges the specified branch to the branch which you are currently at.
git branch -d : Deletes a branch
git push origin – delete : Push the change of deleting a branch to github
git help : Documentation of the git tag
Note that git learning curve is a gradual process just like typing. You don’t become a git pro in a day.
I hope you will now start using Git for your projects if you have not been using it before now.
Thanks for reading :)

To dive deeper into git, you can visit their online documentation at: https://git-scm.com/book/en/v2

You can reach out to me on Twitter via the handle: @ilocalistus

Top comments (0)