Basic Of  Git and GitHub

Basic Of Git and GitHub

Day 08

  1. What is Git?

    Git is a distributed version control system (DVCS) that was created by Linus Torvalds in 2005. It has become the most widely used version control system in the software development industry due to its speed, flexibility, and powerful features

Git's popularity stems from its versatility, speed, and the ability to handle both small and large-scale projects effectively. It provides developers with powerful branching and merging capabilities, efficient operations, and a comprehensive version control history, making it an indispensable tool in modern software development.

  1. What is GitHub?

    It is a web-based Git repository. This hosting service has cloud-based storage. GitHub offers all distributed version control and source code management functionality of Git while adding its own features. It makes it easier to collaborate using Git.

    Additionally, GitHub repositories are open to the public. Developers worldwide can interact and contribute to one another’s code, modify or improve it, making GitHub a networking site for web professionals. The process of interaction and contribution is also called social coding.

  2. Git v/s GitHub

    | Git | GitHub | | --- | --- | | Git is a distributed version control system. | GitHub is a web-based hosting service for Git repositories. | | Git operates locally on a developer's machine. | GitHub hosts repositories remotely in the cloud. | | It tracks changes to files and manages history. | It adds collaboration and project management features. | | Git enables the branching and merging of code. | GitHub offers pull requests for code review and merging. | | It allows developers to work offline. | GitHub requires an internet connection for most operations. | | Git can be used with various hosting services. | GitHub is the most popular platform for hosting Git repositories, but other alternatives exist (e.g., GitLab, Bitbucket). | | Git is free and open-source software. | GitHub offers both free and paid plans with additional features and storage options. |

  3. Let's know about Version Control System

Version control is a system that tracks and manages changes to files over time. It enables developers and teams to collaborate effectively, maintain a history of changes, and revert to previous versions if needed. There are three primary types of version control: local, centralized, and distributed.

What is a VCS (Version Control System)? | Version Control Software |  Perforce

  1. Local Version Control: Local version control systems are simple and operate on a developer's local machine. They typically involve creating copies or snapshots of the entire project directory at different points in time. Developers manually manage these snapshots and can revert to a previous version when required. However, local version control systems lack collaboration features and are not suitable for teams working simultaneously on the same project.

  2. Centralized Version Control: Centralized version control systems (CVCS) address the limitations of local systems by introducing a central repository. Developers work on their local machines and interact with the central repository to share changes. The central repository stores the complete history of the project and manages access control. Developers can check out files, make changes, and commit them to the central repository.

    Version control concepts and best practices

  3. Distributed Version Control: Distributed version control systems (DVCS) take collaboration a step further by allowing each developer to have a complete copy of the repository, including the entire history, on their local machine.

    Version control concepts and best practices

    In a distributed system, developers can work independently, create branches, make commits, and perform most version control operations locally without relying on a central server. They can later synchronize their changes by pulling, pushing, and merging with remote repositories. Git, Mercurial, and Bazaar are popular examples of DVCS.

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

    1. Better collaboration: In a DVCS, every developer has a full copy of the repository, including the entire history of all changes. This makes it easier for developers to work together, as they don't have to constantly communicate with a central server to commit their changes or to see the changes made by others.

    2. Improved speed: Because developers have a local copy of the repository, they can commit their changes and perform other version control actions faster, as they don't have to communicate with a central server.

    3. Greater flexibility: With a DVCS, developers can work offline and commit their changes later when they do have an internet connection. They can also choose to share their changes with only a subset of the team, rather than pushing all of their changes to a central server.

Enhanced security: In a DVCS, the repository history is stored on multiple servers and computers, which makes it more resistant to data loss. If the central server in a CVCS goes down or the repository becomes corrupted, it can be difficult to recover the lost data.

Git Environment Setup

  1. The Git config command:

    Git supports a command called git config that lets you get and set configuration values on a global or local project level.

    Setting user. name and user. email are the necessary configuration options as your name and email will show up in your commit messages.

    1. $ git config --global user.name "Thakur Yashswini01"

    2. $ git config --global user.email ""

We continue next part in next blog .....Happy learning !!