Chapter1 What is GIT & GITHUB ?
Git is a distributed version control system that allows developers to track changes made to code over time. It was created by Linus Torvalds in 2005 and has become widely used in the software development industry.
Git works by creating a repository, which is essentially a folder that contains all of the files and directories for a project along with their complete history. Developers can make changes to the code in their local repository and then push those changes to a shared remote repository, such as one hosted on GitHub.
GitHub is a web-based platform that provides hosting for Git repositories. It also offers a variety of collaboration tools, such as pull requests and issues, that allow multiple developers to work together on a project.
To use Git, developers first need to install it on their computers. They can then create a new repository with the "git init" command or clone an existing repository with the "git clone" command.
Once a developer has a local copy of the repository, they can start making changes to the code. To track these changes, they use Git commands like "git add" to stage changes and "git commit" to save them to the repository's history.
Developers can also create branches in Git, which are separate versions of the code that allow them to experiment with new features or fix bugs without affecting the main codebase. They can merge these branches back into the main codebase with a pull request on GitHub.
GitHub also offers other features such as the ability to review code changes made by others using pull requests. It also provides a space for project management where developers can keep track of issues, and milestones, and assign tasks to team members.
Overall, Git and GitHub have become essential tools for modern software development. They provide a way to track changes, collaborate on projects, and manage code in a distributed manner, allowing teams to work together more efficiently and effectively.
Chapter2 Types of Version Control Systems
Version control is like taking snapshots of your work over time so that you can go back to any previous version whenever you need to. You can use version control for almost any type of file on a computer, but it's especially useful for software source code or graphic and web designers who want to keep every version of an image or layout.
There are different types of version control systems.
2.1 Local version control Systems
when you make copies of your files into another directory to keep track of changes. However, this approach is risky because it's easy to forget which directory you're in and accidentally write over the wrong file. Programmers created local VCSs to solve this issue. These systems use a simple database to keep track of all the changes made to files.
2.2 Centralized version control systems
Cvcs have a single server that contains all the versioned files, and many clients check out files from that central place. This setup allows everyone to know what others are doing, and administrators have better control over what people can do. But, the downside is that if the centralized server goes down or becomes corrupted, you risk losing everything.
2.3 Distributed version control systems
Dvcs fully mirror the repository, including its full history. If any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it. Every clone is really a full backup of all the data. This setup also allows different groups of people to collaborate in different ways simultaneously within the same project.
Chapter3 Git Workflow
When using Git, your files can be in one of three states: modified, staged, or committed. Modified means you changed the file but didn't save it yet. Staged means you marked a modified file to be saved in the next snapshot. Committed means the changes are saved in your local database. The project has three main parts: the working area (where you do your work), the staging area (where you prepare your changes to be saved), and the Git directory (where everything is saved).
Chapter4 Installing Git
Git is a tool that helps you manage your code. To use it, you need to install it on your computer. You can do this by using a package manager or downloading the source code and compiling it yourself.
4.1 Linux users
you can install Git by running one of the following commands:
sudo dnf install git-all (for Fedora-based systems)
sudo apt install git-all (for Debian-based systems)
4.2 macOS users
There are several ways to install Git on a Mac. The easiest is probably to install the Xcode Command Line Tools. On Mavericks (10.9) or above you can do this simply by trying to run git
from the Terminal the very first time.
You can install Git by running the command:
git --version
If you don't have it installed already, it will prompt you to install it.
4.3 Windows users
Users can download Git from the official Git website https://git-scm.com/download/win
:
Chapter5 Git features and benefits
Distributed version control: Git is a distributed version control system, which means that everyone working on the project has their own copy of the entire repository. This allows for easy collaboration and offline work.
Branching and merging: Git makes it easy to create branches of your codebase, allowing you to work on new features or fixes without disrupting the main project. Merging these branches back into the main codebase is also straightforward.
Speed and efficiency: Git is designed to be fast and efficient, making it easy to manage large repositories with many files and revisions.
Security: Git uses cryptographic hashing to ensure that data is not tampered with or corrupted, providing a high level of security for your code.
Flexibility: Git is highly customizable, allowing you to tailor it to your specific workflow and needs.
Open-source community: Git is open-source software, meaning that its source code is freely available and can be modified to meet your specific requirements.
Overall, Git provides a powerful and flexible platform for managing and collaborating on software projects, enabling developers to work more efficiently and effectively