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.
There are two ways to get a Git repository or repo on your computer, which are as follows:
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.
I will use GitLab as an example here, so my repo is located at https://gitlab.com/yyyy/xxxx which is made up but works as an example.
git clone https://gitlab.com/yyyy/xxxx.git
, this clones the repo into a new sub-directory called xxxxgit clone https://gitlab.com/yyyy/xxxx.git zzzz
, this clones the repo into a new sub-directory called zzzzYou are now ready to roll.
Files exist in one of four states in Git
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