DEV Community

loading...

Getting Started With Version Control System; Git and Github.

Taiwo Oluwaseyifunmi
Front-End wizard and technical writer
・5 min read

A version control system(VCS) is a software tool that allows you to document changes made to files by keeping a track of changes to a coding block. It is a program that allows you to monitor or handle multiple versions of your source code updates. Version control system helps you understand who made changes, what changes, when the changes were made, and many more.

Alt Text

My very simple analogy for understanding this better is saying the words "version control" backward which gives you "control version" and in this case, "control version" would also mean "back up". This encourages you to make improvements to your coding projects without fear. The key idea of a version control system is to help preserve a detailed project history and its numerous future improvements/modifications. Another name for a version control management method is source code manager(SCM).

It is imperative that we are aware that "version controls" form a part of our daily lives. For example, you don't consciously keep different copies of a document when you type, but your computer does! A major reason why you can "ctrl + z" to dismantle an action when you make errors. Another great scenario is having to retrace your steps whenever you lose something on your way.

So, who can use a VCS?
Versioning(adj.) is a coding practice that should be used by both individual coders and any group of people involved in a project. It helps to keep code organized, clean and changes, traceable.

What are the benefits of Version control systems?
Version control systems help developers do the following:

  1. Understand better the changes made to projects by keeping track of who, where, and why adjustments were made.
  2. Foster the remote working culture.
  3. Helps developers take screen breaks and time away from monospace fonts without fear.
  4. Maintenance of multiple code variants.
  5. Have complete backups to their projects without occupying much space.

Moving on, there are three version control models. Just like we have various operating systems and myriads of devices running on each one, the same thing we've got running for version control systems. There are three version control models, each of which has different version control software using them.

Types of version control system models:

  1. Local Version Control System: in this model, all developers on the project have access to only one copy of that project. Meaning that if any changes were to be, the developers have to manually make a copy of that file before making changes to it.

  2. Centralized Version Control System: this is a model where you have to save the snapshot of the application on the server, with history changes saved in the server. This model requires that all developers have access to the files via the internet of a local network. SVN is an example of a centralized version control system, also known as "Apache Subversion".

  3. Distributed Version Control System: In this model, each developer works directly with their own local repository, and changes are shared between repositories as a separate step. Distributed VCS is the inverse of centralized VCS, it gives all the manageable/traceable of the project in the developer/client-side, not server-side. You can check out the branch without connecting to the server, you can also commit changes, trace changes that you have made even without an internet connection. Git is an example of a distributed version control system and has an emphasis on speed and performance. Git is an example of a distributed version control system and has an emphasis on speed and performance.

Git And Github.

There is an erroneous assumption that Git and Github or that Git is simply a funky way of saying Github, especially among noob devs. Git and Github are in fact, two separate entities.

Git is a free and open-source distributed version control system like I earlier mentioned that helps you manage and keep track of your source code changes. Github on the other hand is a cloud-based service that helps developers manage Git repositories (repositories store instances of your code work). From production down to shipment, Github and Git help build collaboration directly into the development process.

Alt Text

Git installation guide
If you already have git installed, that is no problem but if not you can download it here
To open an account on Github, you can sign up here

Git Jargons

Whether as a complete beginner or an experienced developer, you are eventually going to speak the Git language - which sounds super cool. I have highlighted a few of the most common Git commands you'll frequently come across as a developer.

Repository: Sometimes called 'repo' contains the collection of the files making up a project as well as the history of changes made to those files. Repositories in Git is considered as your project folder.

Branch: a branch in Git is a way to keep developing and coding a new feature or modification to the software and still not affecting the main part of the project. It is an essential feature available in most modern version control systems. A Git project can have more than one branch. We can perform many operations on Git branch-like rename, list, delete, etc.

Master: Master is a naming convention for Git branch. It's a default branch of Git. This branch is called a "master" branch because it is a repository's "default" branch.

Remote: In Git, the term remote is concerned with the remote repository. It is a shared repository that all team members use to exchange their changes. A remote repository is stored on a code hosting service like an internal server, GitHub, Subversion, and more.

Git clone: The git clone command generates a local duplicate of an existing project just as its name suggests. The clone operation provides the remote repository with a case. The clone holds all project data, history, and divisions and helps you to copy files of other nations

Pull: The term Pull is used to receive data from GitHub. It fetches and merges changes on the remote server to your working directory. The git pull command is used to make a Git pull.

Pull requests: They are a process for a developer to notify team members that they have completed a feature. Once their feature branch is ready, the developer files a pull request via their remote server account. Pull request announces all the team members that they need to review the code and merge it into the master branch.

Push: The push term refers to upload local repository content to a remote repository. Pushing is an act of transfer commits from your local repository to a remote repository. Pushing is capable of overwriting changes; caution should be taken when pushing.

Git is very useful and important to learn if you want to level up in the tech field. You can watch tutorials on YouTube to learn more. Later on, I will make the second part of this article with advanced commands.

Discussion (3)

Collapse
gbenga19 profile image
Gbenga19

Simple and well structured.

Collapse
bmeera profile image
Ameerat Bello

I was one of those who couldn't really differentiate Git from Git Hub then. This article is enlightening.

Collapse
igbominadeveloper profile image
Favour Afolayan

Nice article. I wish we had something like this when we were starting out.