Download Git

Download git from this link - https://git-scm.com/downloads

Once installed, open the terminal and run following command to check if git is installed or not:

git --version

Screenshot 2024-08-10 at 1.42.45 AM.png

If installation is successfull it will give version of the git.

Configure Git

Now let Git know who you are. This is important for version control systems, as each Git commit uses this information:

git config --global [user.name] "NAME"
git config --global user.email "EMAIL"

Creating Git Directory/Folder

Let's create a new folder with name demo for our project:

mkdir demo
cd demo
ls
Screenshot 2024-08-10 at 1.49.53 AM.png

As we can see the demo directory is empty.

Initialize Git

Once we have navigated to the demo folder, now we can initialize Git in this folder:

git init 
Screenshot 2024-08-10 at 1.51.39 AM.png

Git creates a hidden folder .git to keep track of the changes.

It is a hidden folder hence we used ls -a command to see it

Initialize Git

Let’s make some changes in this newly intialized repository!!

Screenshot 2024-08-10 at 1.56.22 AM.png

Hence we created a file demo.txt and added text “Hello World” in it.

Check Git Status

git status command shows us the current state of our files in a Git project, telling us if we have made any changes, if there are files ready to be saved, and if there are new files that Git hasn’t started tracking yet.