Day 9 - DevOps Learning: - Git And GitHub

Git is a version control system which enables version controlling of a code and relevant files of a software professionals. One of the first thing comes to our mind is why do we need a version controlling system? Following are few of the reasons and example explaining why do we need it.

  • One of the key reason is sharing. In an organization, there are many developer and professionals are working on the same project. This enables effective collaboration within a team and also increase efficiency at the same time. In addition, it also creates consistency and effective product.

  • The second reason is versioning. While one if working on a code to develop a website. In a day-to-day life, one has to revamp the code many time and it often seen that it require the access to previous version of the code, so having version of the code helps through the development journey.

Consider the following example,

Here, two developers are working of developing calculator application. While developer A is working on the additional functionality and developer 2 is working on multiplication functionality. Sharing of the code is one of the most important thing so It will combine both the functionality and create wholesome product.

And also developer A is assigned a task to modify the additional functionality. But after modifying, performance went down and then assigned to put the old code back, in this case versioning comes to the picture and helps the developer to assess the previous code.

Why GIT?

Before GIT there are many version controlling system used by developers such as SVN(Subversion) CVS(Concurrent version system). However, GIT has the most popularity. Following are the few reasons behind the popularity.

  • GIT is opensource with an active community. As a result, GIT is widely spread among the developers. Which resulted into hosted platform like GitHub, GitLab, Bitbucket, which also developed popularity among the developers.

  • Unlike SVN and CVS, GIT is distributed system where every developer who is working on the same project has its own copy of the project and can develop project according to the requirement and test on your own.

  • GIT branching and merging strategies are much easier to develop and manage compared to CVS and SVN.

GITHUB: What is it and How to use it?

GitHub is a web-based platform for creating and managing git repositories With having wide range of features it makes GitHub a largely used platform for GIT.

  • Usability

  • Issues

  • Commenting

  • Project management.

These are few features make GitHub unique than different platforms.

GIT Commands

GIT can be used using CLI and GUI. For GUI it needs to depend on the platform like GitHub, Bitbucket and it is not scalable for repetitive tasks. For those scenarios CLI comes into the picture. Following are the GIT commands which are used on day-to-day basis by a developer.

  • git init : This is the command which is used to initialize git repository within a directory. when you run this command Git will set up all the necessary file and data structure to set up and keep track of the relevant files.

  • git add : This command is used to add the file or relevant folder to git. So it can keep records of any changes to file and folder.

  • git status : This is the command to list the files and folders and its any changes. it also display current state of the files and also show relevant information on untracked files.

  • git diff : This command showcase the different of the previous and current state of the file and show the difference between file.

  • git commit -m "message" : This command is used to push the changes to repository with the specified message to understand the changes of the file.

These are the only few commands which are used on day-to-day basis by developer or professionals.