What is GIT, Github, Gitlab? | Introduction To GIT


Git is distributed version control system, In earlier days when we don’t have distributed version control, Developers used to develop and store the code in physical storage (Floppy, tapes, Disk) and it was difficult to merge the code between developers, usually used to get more errors (Difficult to maintain). Github is a web-based GIT repository hosting service.

git logo

I strongly suggest every developer learn this first, Irrespective of the language you start to code, you need git to maintain your codebase well.

Read till the end of the article to understand Git, Github, Gitlab.

What is GIT?

Git is developed in 2005 by Linus Torvalds, an awesome creator of the Linux OS kernel.

Git is the distributed version control system, which is used by software developers to maintain the code revisions, store them remotely (somewhere safe so physical damage to local storage is not a concern), also gives the ability to developers to work from remote places and helps in collaboration with each other.

Git tracks the changes of files, so you have a record of what changes you have done for specific files and specific versions. It also makes collaboration easier, allowing changes by multiple people to be merged into a single code base. To work as a team Git is essential and very useful.

Nowadays git can be used not only by the terminal. we can also use a GUI tool called source tree. This helps the newbies to learn and adapt fastly.

Git Repository

Git repository (normally called repo) contains the project files and the entire revision history. To convert the normal folder to the git repo. we need to run the command git run init. The repository folder contains the .git folder which contains all the metadata for the tracking changes.

Usually, in many operating systems like mac .git folder will be hidden (will show when you make hidden folders viewable).

Staging And Committing The Files.

Staging of files is telling the git to record the changes made by the developer. Each recorded set is called commit in terms of Git.

Before we commit locally we need to tell the git what files we want to commit. This is called staging, we use “Git add <file name>” to stage the file. we can stage only required files that need to be committed.

We use ‘Git commit -m “<messgae>”‘ to commit the staged files.

To push these commits to remote (in server) we use “Git push origin <branch>”.

Remote Repository

Project in Remote server (Github) is called Remote server. we usually called remote. This is the centrally located place where developers can contribute to each of their development.

we use “git pull <branch name>” to pull the changes from the remote, we use “Git push <branch>” to push the code to the remote (usually done after committing).

Branching and Merging

Git allows branching out from the original code base, this helps the developer lot of flexibility in work flow and later when they finish the development they will merge the branched out branch to the main branch (Usually the master or software release branch).

Here is a beautiful example of how the branches and merging work. Suppose you are developing a website and branching out from the main branch (master branch) called the “feature 1” branch. Now clients want to make a release so you come back to the master branch and make the necessary changes and release. When releasing is done you can go back to the feature1 branch and complete the work and merge the feature1 branch to the master branch. Whenever necessary make a new release to reflect new changes.

Pull Requests in Git

Once we make a commit and push the code to the remote branch. we can compare the feature branch1 to master to check the difference and code reviewing can be done. you can discuss the changes, later you can decide you need to merge or not.

What is Github?

Git helps to create your local repository in a local system where Github is the web app that shows the central repositories in the remote. In Git hub you can make changes to code and make them visible in the repository. In Github, you can see many public repositories other than your repositories.

What is GitLab?

Gitlab and Github are products providing Git repository hosting services. Github is hosted by git whereas Gitlab is hosted and managed by company. Gitlab has (A community edition CE) opensource and Gitlab EE (enterprise edition). similarly, Github also has enterprise edition and Github.com.

What is the difference between Git and Github?

GIT:

Git is the distributed version control system, which is used by software developers to maintain the code revisions, store them remotely (somewhere safe so physical damage to local storage is not a concern), also gives the ability to developers to work from remote places and helps in collaboration with each other.

GITHUB:

Git helps to create your local repository in a local system where Github is the web app that shows the central repositories in the remote. In Git hub you can make changes to code and make them visible in the repository. In Github, you can see many public repositories other than your repositories.

Here are the differences between Git and GitHub for a better understanding of git and GitHub.

SL NoGITGithub
1Git is the command-line tool.Github is GUI based web app.
2Git is the software.Github is the service.
3Git is software installed on the local machine. Github is hosted on the web (cloud).
4Git was released in 2005.Github was later hosted in 2008.
5Git is a version control system to manage code history.Github is centralized Repositories hosting.
6Git was maintained by Linux.Github was maintained by Microsoft.
7Git has many third party applications like source treeGithub has a desktop interface named GitHub desktop.
8Open-sourceHave free tier and pay per user also.
9no user management featureBuilt-in user management feature
10minimal external tool configurationactive marketplace for tool integration
11competes with other distributed versions like svn, mercurial,etc.competes with GitLab, git bitbucket, etc.

Final Thoughts:

At the earlier stage of my career, we manually merged the code using a pen drive to transfer the developer changes, later I learned this git, which I felt is very useful and essential for every developer.

Recent Posts