Git for Beginners
Published: 2022-08-13 12:39:00

**Birth of Git**

Until April 2005 Linus Torvalds was using BitKeeper for version control of the Linux Kernel development. He had a large number of volunteer developers working on the Linux Kernel and their contributions had to be managed. BitKeeper was a nice tool for managing the enormous contribution by the developers. The Linux developers used the tool for free after an agreement between the two parties as BitKeeper was a proprietary source control management system which means you had to pay for the use of the tool. There came a conflict of interest after Andrew Tridgell created an open-source client for accessing the Bitkeeper version control system by reverse-engineering the BitKeeper protocols. This caused the copyright holder to withdrawal the free-to-use policy that they had earlier agreed upon. Many developers of the Linux kernel gave up access to the BitKeeper. 

Linux knew he had to act fast to replace the version control system that he knew and loved so he took a working vacation to decide on what to do as the current free-to-use version control systems could not solve his problems at the time. The result of his vacation was the birth of a new version control system named Git. 

**Strengths of git**

- Works in multi-platform.
- Small and quick.
- Distributed development.
- Strong support for non-linear development.
- Automatic Garbage Collection.


**Why Use It?**

Git is useful to anyone who writes code or track changes to files, it is the most commonly used version control system.
Git lets multiple developers easily work together on the same project with speed and efficiency.Tracking and history are available, even when off-line.
Git is used for tracking and managing changes in files (In reality, git doesn't save the file but save the history of changes in a file).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/66egdfdwxh7fte42afr0.png)

**Installation**

> On Linux

- Using apt:

`sudo apt-get update
sudo apt-get install git-all`

- Using dnf:

`sudo dnf install git-all`


### 

## 
## How use it

After creating the project we will start by :

```
git init
```
 Create an empty Git repository or reinitialize an existing one, in this stage you will be in "default" branch called "master",it is a naming convention for a branch.

```
git status 
```
Used to display the state of the repository and staging area(display the change in your project)

Tow floors appear to us after use this command:

`Untracked `: This file exists locally, but isn’t a part of the Git repository. The file’s change history will not be recorded and it will not be pushed to remote.

`Tracked`: Git tracks the file’s change history and it will be pushed to remote copies when running git push. At this point, the are two situations:
> "Unstaged changes":
 Exist in your working directory, but Git hasn’t recorded them into its version history yet.

> "Staged changes":
  Are a lot like unstaged changes, except that they’ve been marked to be committed the next time you run git commit.

```
git add
```
Add file contents to the index. The status of your changes goes from "Untracked and Unstaged" to "Staged".

```
git commit
```
Record changes to the repository. before committing you must know the "Conventional Commits", it mean you will try to add a human and machine readable meaning to commit messages see:[Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#specification)

```
git push 
```
To integrate the branch to the remote repository.

```
git log --oneline --decorate --all --graph
```
 Show commit logs.

## Git Extensions must have in VS Code

- GitLens

- Git Graph

- Git History

Hope you were able to gain something from this article.
If you have any questions do not hesitate to contact me [saber mekki](https://www.linkedin.com/in/mekki-saber/)