3.1 Basic Git Concepts

Links: Source Control for Test Automation with Git MOC

3.1 Basic Git Concepts

Source Control for Test Automation with Git MOC-1677907520516.jpeg|500

Source Control for Test Automation with Git MOC-1677907550580.jpeg|500

With the third command, git status, you are able to see all the current path differences between working directory, staging index area, local repository and remote repository if you have configured a remote one.

Source Control for Test Automation with Git MOC-1677907571298.jpeg|500

Source Control for Test Automation with Git MOC-1677907762029.jpeg|500

The fourth command is git log.

With git log, you can see all the commits which were created on a branch. It shows you the whole commit history including the hash, the author, and the date of the current active, which means checked-out local branch.

NOTE

At this point, I would like to mention that for each of the commands in Git, there do exist a couple of additional options you can concatenate, but we won't go through them in this course. That's something you can read up on your own in the official online Git documentation.

Now the time has come to dive into the basic concepts. The first one we are starting with, is initializing.

Source Control for Test Automation with Git MOC-1677907632908.jpeg|500

When we initialize a repository locally, we will get these three boxes. They represent the development environment. As we already learned, these boxes are called the three Git trees.

Let's have a closer look at these three Git trees.

By initializing a Git repository (using git init) a hidden directory named “.git” is created.

This directory contains the index file, the local repository and all the other information that is necessary for our project. Information about commits, remote repository if available, addresses, a lock which stores the commit history, et cetera.

You can see the “.git” directory is a bit of a magic place where we put our magic show in.

If we want to destroy a local repository, we just have to re-delete this folder. That is why this folder is hidden to omit that we accidentally deleted.