Luca Nerlich A blog about Tech, Programming and Games.

How to use git

In this blog post, I will explain how to use git and gitlab.

Git is the most popular tool for file versioning.

In general Git is based on a central “bucket” to store all your files. All updates are pushed to this bucket -> repository. Every user can download / clone this repository to his local machine and work with these files. Whenever the user wants to save/share his updates, the uploads (commit + push) his changes into the central bucket / the repository.

This blogs repository is hosted on my own GitLab instance.

The four most basic steps when using git are as follows:

  1. git clone <repo_url> -> download a copy of the repository.
    • ssh: git clone git@https://gitlab.lucanerlich.com/luca/jekyll_blog.git
    • https: git clone https://gitlab.lucanerlich.com/luca/jekyll_blog.git
  2. git add . -> add all local file changes to the list of files which will be updated
  3. git commit -m "<description of changes" -> “save” the changes into a new state.
  4. git push -> upload all states of changes.

Git has a ton of features. The above are just the most fundamental. I suggest to use one of the following GUI Tools to make your day to day work a bit easier:

Checkout either of these two handy git cheat sheets:

Install Git on Windows:

Thanks!

luca

category

howto