Version controlling with Git and GitHub

Upendra Ihalagedara
5 min readMay 13, 2022

Throughout this article I hope to talk about a important concept which is something important for almost all kinds of developers which is the version controlling. Other than that, will have idea about the what git and GitHub are with their advantages.

What is version controlling?

The basic and the simplest idea is keeping track of the changes in order to mange them in a proper way. This thing comes to the action when we are dealing with some kind of a development process while collaborating with a team or some members. In this kind of situation, it will ensure and helps us to keep track of the changes we are doing. So that the communication and the collaboration between the team members will be improved and the code will be more manageable. So when ever we do some changes it will be visible to other developers and they also can have a better idea about the changes and the person who did those changes.

So, there are many advantages of using version controlling.

· Identity

· Branching and merging

· Traceability

· Efficiency

· Conflict manageability

· Less duplications and errors

What is git?

Since we have talk about the version controlling, lets talk about the version control system available. There are some popular version controlling systems like Git, Monotone, Bazarr, TFS…etc. Among these systems Git is something popular among the users. Git is a distributed version control system which is designed to handle everything from a simple project to large and complicated projects. Other than that git is free, open source and it helps to do the implementation in a speed, manageable and more efficient manner. Basically, when ever we want to change the version or if we want to stay with the previous changes that we have done, git will provide the opportunity to do that since it holds all the records.

What are the importance of using git?

Mainly there are two categories of version controlling systems.

· Distributed version control systems.

· Centralized version control systems.

One of the main importance of using git is it is a distributed version control system. Before git there were many centralized version control systems like CVS. The meaning behind the word centralized is, every user gets a copy which points back to a central repository. In git every use have their own repository complete with full history of commits.

What are the basic commands in git?

First of almost before working with git we need to configure the user information. So, we can set our name and the email so that we will be more identifiable. This process can be done by the following commands.

In the above code snippet we can put our name inside the inverted commas where I have put “example name”. like wise we can set out email as well

In here also we can put our email where I have put “example@example.com”. So when ever you are going to contribute, you detail will be visible to others.

Initializing a new repository

This one of the main commands that we need to know in order to start working with git. With the following command we can initialize our git repository.

This command will create a brand new git repository in the local file system. In reality what we can see is a .git file has been created in the root of the file location and it will contain all of the to keep the track of the changes.

Talking about the file changes, git provides us a smooth way to track all of our changes. Mainly we can divide the files in to three different stages.

· Modified — has done some changes but they are not been committed

· Staged — has done some changes and ready to be committed in the next commit

· Committed — has saved the changes in the locally

In order to clone a repository, we need follow the following command.

If we need to check the status where it shows the modified files in the working directory, we user the command git status. This will show the status of the repository whether we have any untracked changes to be committed. If not it will say that the repository is up to date.

Once we check the status, if there are any thing to be added we can do it by the following commands. One way is adding a specific file by giving its name. The other way is adding all the file with the command “git add .”.

The next step is to commit all the changes we have done. We can simply commit the staged area file by the following command.

What is GitHub?

GitHub is a hosting platform for software development and version controlling using git. GitHub offers distributed version controlling and source code management functionalities of git. Simple idea is it is a platform to share and manage your code. This has become very useful and popular because it makes the tasks easy for developers as well as the large companies and organizations to manage their projects and collaborate with others.

So, these are like the basic commands, and if we are dealing with a place where that can host out git repositories like GitHub, we need to have the idea about some other commands as well. Some of them are git branch, git push, git diff…etc.

Let’s talk about more about the version controlling and more about GitHub from another article. Thank you!

--

--