What is GIT? How to Install It? How to Use It? And Basic Commands


It is a Version Control System that was created by Linus Torvalds in 2005, thinking about the efficiency and reliability of application version maintenance when they have many source code files. Its purpose is to keep track of changes in computer files and coordinate the work that various people do on shared files.

This open source software allows us to control all the changes we make to any file. Although it is true that it can be done manually, but this tool allows you to keep a record, maintain a history and manage any changes in a file or set of files throughout the time of a software project, so that you can recover specific versions later.

Git install


Linux systems use the same default keyboard shortcut to start it.
Open terminal: Ctrl+Alt+t
Run the following command:

Linux (Debian): sudo apt-get install git

Linux (Centos): sudo yum install git


Run the following command: brew install git


Download installer https://gitforwindows.org/


In order to customize your Git environment, you need to do these things only once on your computer. You can also change them at any time by running the corresponding commands again.

Git brings a tool called git config, which allows you to get and set configuration variables that control the look and feel of Git. These variables can be stored in three different places:

The first thing to do when installing Git is to set your username and email address. This is important because Git commits use this information, and it is immutable in the commits you submit:

$ git config –global user.name “Pepito Perez”
$ git config –global user.email pepito@example.com

Testing the Configuration

You can use the git config –list command to display all the properties that Git has configured:

$ git config –list
user.name=Pepito Perez

You can also check the value that Git will use for a specific key by running git config :

$ git config user.name
Pepito Perez

Basic Commands

git init
This command is used to create a new Git repository.

git add
Add content from the working directory to the staging area or index for the next commit.
git add temp.txt

git status
It will show you the different states of the files in your working directory and staging area.

git diff
This command is used to make a list of conflicts.
git diff –base (file-name)

git difftool
Run an external tool to show the difference between two trees, in case you want to use something other than the built-in git diff command.

git commit
It grabs all the contents of the files that are tracked with git add and records a new permanent snapshot in the database and then advances the branch pointer to the current branch.

git reset
The string of numbers and letters that appears next to the word commit is the identifier that we can use to revert the changes and go back to that point.
git reset –hard IDENTIFICADOR

git rm
vIf we want to delete the files that we have just added to be saved we can do it with this command.

git mv
It is a convenience command to move a file and then run git add on the new file and git rm on the old file.

git clean
It is used to remove unwanted files from your working directory. This could include removing temporary construction artifacts or merging conflicting files.

These are some basic commands of Git, this tool has been very helpful for the development of projects and I hope you can take full advantage of it.


Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *