An introduction to GIT
14/06/2021
Git is a versioning system designed to keep track of the changes applied to a source code base. Using GIT (or typed Git usually), we can add commit and push changes to local machine or distant servers. We can access the history of changes, and collaborate with others on the same code base, by fetching the changes they committed to the source code and merge them in our local branch, so we can get the latest features they worked on.
First, we will start by showing how to install GIT, create a Git repository locally, how to add files to Git and how to commit the changes.
Installing Git :
In order to download Git, go the official Git website and you will be prompted with the correct version of GIT for your plateform, you can choose other plateforms with the interface :
After downloading, just open the install file and follow the instructions until installation on your machine is finished
You can check that you have successfully installed Git by running : git --version
In my case :
Git commands work in the following pattern : git git-command-here parameters
You always start your command with git, then follow it with the verb/noun that represents the command.
2. Starting a Git repository :
In order to start a Git repository, i.e. a folder that Git will be able to track its contents, you just have to create an empty folder and type :
git init
Git displays a message indicating that it has started an empty Git repository in your_folder/.git
But what is that .git ?!
.git a hidden folder where Git keeps all the history and the configuration for the current Git repository. So be very careful, because if you delete this folder, ALL GIT DATA IS LOST FOREVER ! So never touch this folder unless you are very sure of what you are going to do !
Here is a screenshot of the .git folder :
Enough for today, in the next tutorial we will see how to configure a repository, add files to Git, and commit changes.
Happy learning !