What is Git , What is GitHub and version control

What is Git , What is GitHub and version control

·

6 min read

What is Git

Git is a distributed version control tool designed to track changes in software by Linus Torvalds the same person who creates Linux.

Git is used for tracking software versions, managing code and collaborating between developers.

Git is a version control system that tracks the challenges on doc/code and coordinates work on those files among multiple people. It is primarily used for source code management software development but it can be used to keep track of changes in any set of files.

hen a developer makes a change to the code, Git creates a snapshot of the code at that point in time. These snapshots are saved as commits and can be viewed and managed using Git commands.

Features of Git

  1. Branching: Git allow to developer to create a branch of the main code and it is used to create a new feature or bug fixing

  2. Merging : Git provides a feature to merge your other branches with the main code or main branch. This ensures that changes are integrated and tested before being deployed.

  3. Distributed architecture: Git is a distributed version control system that allows developers to keep a copy of the code on their local machine and work on it even if they are not connected to the internet.

  4. Collaboration: Git allows developers to pull/push their code and purpose changes and ask for feedback from other developers.

  5. Continuous Integration and deployment: Git can be integrated with CICD tools to automate the testing, building, and deployment of code changes. This helps to ensure that changes are quickly and consistently deployed to production.

In summary, Git is a distributed version control system used to manage and track changes to software code. It provides branching and merging capabilities, a distributed architecture, collaboration tools, and can be integrated with CI/CD tools to automate the testing and deployment of code changes.

What is GitHub

GitHub is a web-based that provides hosting or storage for version control like git repositories. It is one of the most famous Git hosting platform and is widely used by developers for software development.

GitHub provides a web interface for managing Git repositories, which allows developers to view, manage, and collaborate on code changes. It also provides tools for code review, issue tracking, project management, and documentation.

Here are some features of GitHub:

Git repository hosting: GitHub provided Git repository hosting that allows developers to track and manage changes to the code.

Collaboration: GitHub allows collaboration between developers and organizations with pull requests in which developers can purpose changes and ask for feedback as well.

Code Review: GitHub provides a feature to code review before merging your code into the main branch and this is very important to review the code and ensure that the code is meeting organization's code writing standard or to check if there is an issue with the code before pushing it to the main branch.

Issue Tracking : GitHub provides a feature to track bug, feature requests, and other issues related to the main code.

Documentation: GitHub provides tools for documentation, including wikis and documentation pages, which can be used to document code and project-related information.

In summery: GitHub is a web-based platform that provides storage to Git for their repositories and provides tools for collaboration, code review, issue tracking, project management, documentation etc.

What is the version control

Version control is a mechanism to manage the tracking of a file or set of files over time so that you can recall a specific version later, It allows you to rollback to the previous state of the file and you can revert your whole project to the previous state, can compare the changes over the time, you can see who made the changes in the file, you can track after which commit file having an issue and you can revert to that state where it was working fine.

Types of version control

1 Central version control: Central version control is a version control system in which code changes are managed in a central server or repository.

If a developer wants to work on this code he needs to check out that code first then he can work on it locally and then push their changes to the codebase again to the central repositories.

In a CVCS, all developers have access to the same codebase and work on the same files. This can make it easier to collaborate on code changes and ensure that all changes are integrated and tested before being deployed. However, it can also create bottlenecks and conflicts when multiple developers try to work on the same code at the same time.

  1. Distributed version control system (DVCS) : DVCS like Git allows developers to clone all the code including the entire version history of the code into the local machine.

    It means they have a complete project on their local and no need to be connected to the internet. This means that they have a complete local copy of the repository, including all branches and past versions. Developers can work independently and then later merge their changes back into the main repository also, there is a low risk if the codebase has crashed or the server went down developer still has the clone and can again build the project.

Why do we use distributed version control over centralized version control?

Better Collaboration: As every developer has a clone of the code on their local machine so they do not have to communicate constantly with the central repositories to commit or to see other's changes on the server.

Security: DVCS provides more security capability than CVCS every commit is checksummed and cryptographically secured, which ensures that the codebase is secure and tamper-proof.

Performance: DVCS systems can be faster and more performant than CVCS. This is because they store a complete copy of the repository on the local machine, which means developers can perform most operations locally without needing to communicate with the central repository. In a CVCS, developers must communicate with the central server for most operations, which can be slower and more bandwidth-intensive.

Branching and merging: DVCS like Git provide powerful branching and merging capabilities, which allows developers to create and work on multiple branches of the codebase simultaneously. This is important for collaborative development and can help prevent conflicts when multiple developers are working on the same code. While CVCS also supports branching and merging, it is often more difficult to manage and can lead to conflicts.

Offline work: In a DVCS, developers have a complete copy of the repository on their local machines, which means they can work offline or in areas with limited internet access. They can make changes to the code, commit those changes to their local repository, and synchronize those changes with the central repository when they are back online. This is not possible in a CVCS where developers need access to the central repository to make changes.

Happy Learning

Please follow me for more content

Saif Ali