What is GIT

W

Git is a revision system running on most platforms, including Linux, POSIX, Windows and OS X. Like Mercurial, Git is a distributed system and does not maintain a common database. It is used in large development teams where team members are somewhat independent and are spread over a large geographical area.

Git is developed and maintained by Junio ​​Hamano and is licensed as free software under the GPL license.

Git development began after several developers of the Linux kernel chose to give up BitKeeper’s proprietary revision control system.

Linus Torvalds started the development of the new system on April 3, 2005, to be announced a few days later on the Linux kernel project email list.

On June 16, 2.6.12 Linux kernel was put in Git, which continues today to be the revision control system used by the Linux kernel project.

This git has been created in such a way that it keeps track of all modifiers in a particular code.

Installation

If you use Linux (Ubuntu) then you need to open the terminal (Alt + t) and write the following command:

sudo apt-get install git

A Git repository

A repository is actually a folder where git tracks the changes. Let’s make a new folder and call it a test

mkdir test

Now let’s get into this new folder
cd test

And now let’s initialize git
git init

Git Configuration
Now we need to tell him the name and email address (for setup).
git config user.name “X Y” and for git config email user.email “[email protected]

Changes in repositories
Now that we have configured our repository, we can start using git.

Let’s make some small changes to this folder.

Make a new file:
touch file1 file2

The above command created two new files called file1 and file2.

Another useful command is this:
git status

This shows you the status of the repository where it shows you which files were edited, what files were deleted and what files were created.

Right now we show the 2 files created a bit earlier, file1 and file2, and in order to be able to track the changes we have to add files in staging:

git add file1

git add file2

Now, if we write again git status, we can see that the files are in staging and we can commit.

We can commit using the git commit command:

git commit -m “We created two new files”

You created the first commit.

To see the commit we do not write git status but git log:

git log

Now let’s delete one of these files:

rm file1

This command deleted the file called file1 from the test folder.

If we write again git status, we can see that the file1 is missing (obviously not?) And I will have to update my staging zone using the command:

git rm file1

Now that we write again git status we notice that the file was deleted and we can commit again:

git commit -m “file1 was deleted”

Recent Posts

Archives

Categories