What is Git?
Version control system: A system for tracking changes to files over time.
Code management: The process of organizing and maintaining code.
Collaboration: Working together with others on a project.
Git is a version control system that allows users to track file changes and coordinate work on those files among multiple people. It is commonly used for software development but can be used to track changes to any set of files.
With Git, we can keep a record of who made changes to what part of a file and revert back to earlier versions of the file if needed. Git also makes it easy to collaborate with others, as we can share changes and merge the changes made by different people into a single version of a file.
What is GitHub?
GitHub is a web-based platform that provides hosting for version control using Git.
It is a subsidiary of Microsoft, and it offers all of the distributed version control and source code management (SCM) functionality of Git as well as adding its own features. GitHub is a very popular platform for developers to share and collaborate on projects, and it is also used for hosting open-source projects.
What is Version Control? How many types of version controls we have?
Version control is a system that tracks changes to files over time. This makes it easy to revert to previous versions of files, or to collaborate with others on the same project.
There are two main types of version control systems: Centralized version control systems and Distributed version control systems.
A centralized version control system (CVCS) uses a central server to store all the versions of a project's files. Developers "check out" files from the central server, make changes, and then "check in" the updated files. Examples of CVCS include Subversion and Perforce.
A distributed version control system (DVCS) allows developers to "clone" an entire repository, including the entire version history of the project. 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. Examples of DVCS include Git, Mercurial, and Darcs.
Why we use distributed version control over centralized version control?
Scalability: DVCS is more scalable than CVCS because each user has a copy of the entire codebase. This means that multiple users can work on the same project at the same time without having to compete for access to the central repository.
Availability: DVCS is more available than CVCS because each user has a copy of the codebase. This means that users can still work on their projects even if the central repository is unavailable.
Fault tolerance: DVCS is more fault-tolerant than CVCS because each user has a copy of the codebase. This means that if the central repository is corrupted or lost, users can still recover their work from their local copies.
Collaboration: DVCS makes it easier to collaborate on projects because each user has a copy of the codebase. This means that users can work on the same project at the same time and easily share their changes with each other.
Flexibility: DVCS is more flexible than CVCS because it allows users to work offline and then sync their changes with the central repository later. This can be useful for users who work in areas with limited internet connectivity.
Overall, DVCS offers several advantages over CVCS, making it the preferred choice for many projects.
Task : How to create a new repository on GitHub and clone it to on local machine
Click the "New Repository" button.
Give repository a name and a description.
Select the visibility of repository.
Click the "Create repository" button.
Once repository is created, you can clone it to your local machine using the following steps:
Open a terminal window.
Navigate to the directory where you want to clone the repository.
Run the following command:
git clone https://github.com/[username]/[repository-name].git
How to make some changes to a file in the repository and commit them to the repository using Git.
We will add a file <solution.md> in Day08 of 90dayofDevOps.
Pushing the changes back to the repository on GitHub
Pushing the changes using the git push command. The only requirement for this is to generate a Personal Access Token from the Github profile.
That token then has to be copied and entered between the origin link as shown in the picture. This token is for the Github repository owner to provide access to the developer.
Thank you for reading until here. Keep coding Keep exploring.