Introduction to Git

In this introduction to Git, you will learn how to use git with your InMotion Hosting server. There are many popular hosting platforms available for Git such as Github, Bitbucket, and more. However, if you are interested in managing your own Git repositories on a private server, this is the tutorial series for you.

There is so much you can do with Git version control and file management that we have chosen to limit this tutorial to the bare essentials. This means even though there is much more information available about this program, you will be up and running quickly with everything you need to get started using Git right away.

Whether you choose to use a third party Git hosting platform in the future, or if you prefer to manage your own repositories, in this tutorial, you will learn how to build and manage your repositories from the ground up using command line tools you already have available on your computer. We are going to learn how to initiate a repository and track files, commit changes, tag and sign commits, and how to push changes and deploy files.

The Git Three-tier Architecture

While working with Git you will often hear about the working directory, the staging index, and the repository. These concepts are important to grasp from the very beginning in order to get a proper footing in using Git.

The working directory is where everything starts. This is where you do your work. Files that you are working with are located in the working directory on your computer. Likewise, other users will have clones of the project in their working directories.

The staging index is where you add the files you want to track. Tracking files means that Git is watching them for changes. When you add files to the staging index, you are telling Git “Please include this file in the list of files associated with this project and keep note of all changes made to it.”

It’s easy to think of Git version control as a “journal” containing the detailed history of your project. Those journal entries are kept in the repository. Once you have added files to the staging index, you want to let Git know when to record those changes into the journal. In the Git world, this is called a “commit.” You can think of it as making a commitment to record the changes you made in your working directory to the permanently recorded history. Once changes have been committed, they go into the repository.

Git Three Tier Architecture Image

You should now see the full progression before you: files start in the working directory, they are added to the staging index, and then they are committed to the repository. As you can see above, files can also be “checked out” from the repository, but this is an advanced topic that will be covered later.

Now, we will proceed in this tutorial with how to install Git.

Was this article helpful? Let us know!