Getting Started

It is worth looking at the Learning Git page as this will help you get started and probably explain some concepts better than me, however I want to cover how these commands work.

Creating a Repository

There are two ways to get a Git repository or repo on your computer, which are as follows:

1) Initialise a Directory
  • Either create a new directory or change into an existing one
  • Execute the following: git init

This will have initialised a Git repo in the directory and also created a sub-directory called .git, which is where the repo database is. However this repo is local only, no remote or central server has been setup, see Git Remote for how to do this.

2) Download a Repo

I will use GitLab as an example here, so my repo is located at which is made up but works as an example.

  • Change into the directory that you want to be the parent for where the repo will land
  • Execute the following: git clone, this clones the repo into a new sub-directory called xxxx
  • Alternatively execute the following: git clone zzzz, this clones the repo into a new sub-directory called zzzz

You are now ready to roll.


Files exist in one of four states in Git

files not monitored by Git
also known as "index", marked for inclusion in the next commit
changed since last commit
stored in the local repository
it is best to read about git stash


.git directory – or repository, pulled from remote server, origin of local project files, metadata and object database

Working directory – single copy, or checkout, of one version of the project, pulled from local .git

When a commit is done staging is pushed to .git