DEV Community

Cover image for GIT Quick Course
Walter Nascimento
Walter Nascimento

Posted on

GIT Quick Course

[Clique aqui para ler em português]

What is?

Git is a free and open source distributed version control system, designed to handle everything from small to large projects, with speed and efficiency.

What is the advantage?

Imagine being able to discover changes made to a project, when they were made and who made them? Imagine you can use CTRL + Z in your entire project from the beginning.


Torvalds wanted a distributed system that he could use similarly to BitKeeper (BK), but none of the free systems available met his needs, particularly with regard to performance.

Created in 2005 by Linus Torvalds, development started on April 3, 2005. The project was announced on April 6, and became a self-host on April 7.

more information here.


Go to the git official website page and choose your distribution.
the installation is very easy to do, for windows systems it is just download and next, next and finalize, for linux it is just an apt install git.


When starting to work with git, the first step is to configure it with your defaults, such as email, editor, username and others.

1 — Configuring via the terminal, to configure your git type the commands below

$ git config --global color.status auto
$ git config --global color.branch auto
$ git config --global color.diff auto
$ git config --global color.ui always
$ git config --global core.editor vscode
$ git config --global "meunome"
$ git config --global ""
Enter fullscreen mode Exit fullscreen mode

2 — After the configuration is made, a file called .gitignore will be created and it contains all the settings made, if you need to edit it directly, and you can also back it up so that in future installations it is not necessary to reinstall.

follows my configuration file.


  • LOCAL: To use git locally, no extra installation is needed, just use git init and ready local server is already working
  • GITHUB: GitHub is a Shared Web Hosting Service for projects that use Git versioning control, it has features of a social network such as feeds, followers, wiki and a graph that shows how developers work on the versions of their repositories.
  • Bitbucket: Service similar to Github.
  • Gitlab: Similar to Github.


To make the communication between machines and servers, it is best to add an ssh key, thus avoiding the need to enter login and password every time to send a new change, if you use linux you can follow the steps below:

cd ~ // go to home
$ sudo apt-get install ssh
$ ssh-keygen
// file name (enter)
// password
// re-password
$ cat ~/.ssh/ (send the contents of the file to the owner of the project add you)
Enter fullscreen mode Exit fullscreen mode

Adding public key on the server

  • github: to add the key on the github server just access the configuration link and then click on keys, now just click on the ‘add new key’ button and paste the content of here.
  • bitbucket: To add to bitbucket just access your user’s configuration page after the link ssh keys,, now just click on the ‘add key’ button and paste the contents of here
  • gitlab: To add the key in gitlab, just enter the profile settings (Profile Settings) then ssh keys option (ssh keys). now just click on the Add SSH key button;

Starting Project

To start a project with git just follow the steps below.

  • Creating repository: To create the project locally type git init
$ git init <directory>
$ cd <directory>
Enter fullscreen mode Exit fullscreen mode
  • Cloning a Repository: To download (clone) a project from some server type git clone
$ git clone <link>
$ cd <directoryCreated>
Enter fullscreen mode Exit fullscreen mode


What is it for?

A commit serves as a turning point in the project. Git has tools that make it possible to access the project exactly as it was when each commit was made. This has several advantages, such as providing more security to make modifications to the system (after all, if the change is incorrect, it is possible to revert the commit and return the project code to how it was before the commit was made) or facilitate bug fixing. , as it is possible to execute the project locally in a commit prior to the introduction of a specific bug in the code.

How to make a commit?

To make a commit, you choose the items you want and then add a message

$ git status // Checks the items you want to send
$ git add <file_name> // Add the file
$ git commit -m "Commit message title" // Write the commit
Enter fullscreen mode Exit fullscreen mode

Creating GitIgnore

When we use git we can define files that we do not want to send to the server, for example log files, third party folders or configuration files, for these cases we can create a file called .gitignore and add the files or directors that we do not want to send.

in this link we can create the default directories to include in .gitignore

Commit with emoji

If you want to make the commit more ‘elegant’ it is possible to add emoji both in the title and in the body of the message, however it is necessary to check if the server is supported.

Coding Standard

Some small tips on how to write a commit, but that help to maintain a good history in a project.


If you need to read ask questions we have the official website
But if you want something more direct we have git explorer

Quick courses

If you need to have an overview with a practical course you can try the links:

Command List

List of commands for GIT.

Thanks for reading!

If you have any questions, complaints or tips, you can leave them here in the comments. I will be happy to answer!

😊😊 See you! 😊😊

Top comments (4)

darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Just a few nitpicks from someone who spends way too much time bikeshedding about VCS:

  1. Regarding "Hosting", it's often overlooked that any old linux server with SSH and Git installed can be used to host repositories.

  2. Using --message or -m is a 98% guarantee that your commit messages suck. Don't do this, it's just lazy, unhelpful and leads to much frustration when hunting bugs.

  3. "git clone <link>" Not so much a link, actually. You can clone from a local directory, over SSH, etc.

  4. Using Vim as the default editor might not be the best advise for a "quick course". Chances are, most people familiar with Vim will just read the git documentation. Setting it to something like VSCode might be more helpful to beginners.

  5. Git used block-chain technology before it was cool.

walternascimentobarroso profile image
Walter Nascimento

thanks for the comment. I appreciate the suggestions, especially about using vscode as an editor for beginners, great idea, I'll add in the post.

zilti_500 profile image
Daniel Ziltener

Using --message or -m is a 98% guarantee that your commit messages suck.

Are you trying to sell some tool, or what exactly is your point?

darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️ • Edited

My point is that using --message leads to commit messages that are both too short and poorly formatted. Having a proper editor makes it easier to write a proper commit message, while people who are used to -m tend to just write unhelpful one-liners all the time.

Edit: Also, if I was trying to sell some tool, I'd be doing a very bad job at that by not even mentioning said tool in my comment lol.