Git Version Control System and GitHub

Hilal Gevrek
4 min readMar 27, 2023

--

In this article, I will cover the details of GitHub, a web-based storage service for software development projects, and the Git Version Control System.

  • Git and Version Control System

Git is a free and open-source version control system designed to handle everything from small to very large projects with speed and efficiency. It is a distributed version control system for tracking changes in source code during software development, enabling multiple developers to work together on non-linear development.

You can find many Git Bash cheat sheets provide a basic reference for beginners and advanced developers.

Why do we need Git?

  • Backup / Archive / Versioning / History
  • Undo changes
  • Comparing
  • Collaboration and teamwork
  • Code Review
  • Blame

The responsibility of the Version control system is to keep all the team members on the same page. All team members/developers can in coding collaboratively and remotely. It makes sure that everyone on the team is working on the latest version of the file and, most importantly, makes sure that all these people can work simultaneously on the same project. The project team continuously produces new source codes and keeps adjusting the existing code. These changes are recorded for future references and can be used if ever needed in the future. Developers can discover the root cause of any particular problem to go back at any time and compare the earlier versions of the code. The project team always can also see who modified and what.

Some of the most preferred and popular open-source version control systems and tools are listed:

Top 5 open-source version control systems and tools
  • GitHub

GitHub is a Git repository hosting (Source Code Hosting) service. It lets you and others work together on projects from anywhere. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous integration, and wikis for every project.

Projects on GitHub can be accessed and managed using the standard Git command-line interface; all standard Git commands work with it. GitHub allows users to browse public and private repositories on the site.

Difference is between Git and GitHub is: Git is a version control system that lets you manage and keep track of your source code history locally. GitHub is a cloud-based hosting service that lets you manage Git repositories.

  • Git & GitHub

You can use Git Bash for the Git commands. Git Bash is an application for Microsoft Windows, allowing developers to use Git in a command-line interface.

Let’s cover the details of GitHub essentials like repositories, branches, commits, and pull requests.

A repository is a directory or storage space where your projects can live. Sometimes it is shortened to “repo.” It can be local to a folder on your computer, or it can be a storage space on the cloud. You can keep code files, text files, image files, etc. inside a repository.

Branches allow you to develop features, fix bugs, or safely experiment with new ideas in a contained area of your repository. You always create a branch from an existing branch. Typically, you might create a new branch from the default branch of your repository. Branches allow you to work on different parts of a project without impacting the main branch. When the work is complete, a branch can be merged with the main project. You can even switch between branches and work on different projects without them interfering with each other.

Commits are the core building block units of a Git project timeline. Commits can be thought of as snapshots or milestones along the timeline of a Git project. Commits are created with the git commit command to capture the state of a project at that point in time.

Pull requests let you tell others about changes you’ve pushed to a branch in a repository on GitHub. Once a pull request is opened, you can discuss and review the potential changes with collaborators and add follow-up commits before your changes are merged into the base branch.

  • Understanding How Git Manages Data

In a Git repository your file can reside in three main states: Modified, Staged, and Committed.

Main states of Git

- Modified means that you have changed the file but have not committed it to your database (repo) yet.

- Staged means that you have marked a modified file in its current version to go into your next commit snapshot.

- Committed means that the data is safely stored in your local database.

This leads us to the three main sections of a Git project:

  • Working Directory: Where you work. Create new files, edit new files, delete files, etc.
  • Staging Area (Index): Before taking a snapshot, you’re taking the files to a stage. Ready files to be committed.
  • Git Directory (Repository): Committed snapshots of your project will be stored here with a full version history.

I hope I helped. See you in my next post 🙂

--

--