To GIT or not to GIT, that’s the question.


When you’ve worked in several development teams, you learn that version control is REQUIRED. Not knowing how to handle such tools could be a DISASTER. So our first post is about GIT, because working in a team is cool, like “OK Go” do in the video.

TRUE STORY (2015) we entered in a company in which the code is distributed using a file sharing tool (we don’t  want to advertise because they do not pay us, the tool is DR *** OX). You can’t imagine how frustrating this was,every time someone made a change, all changes made by another person were overriden, the changes are not combined, nobody knows what has happened in the last update and returning to previous changes is … impossible. I do not want to write anything else because my anger is coming.

CONCLUSION: if you want that the relationship between the code and the development team works, a version control is definitely needed. We think that this is basic in order to create any project in an efficient way.

Review, learn, whatever, but you need this post and you know it.

You know it

So we write some guides to perform version control with Git, which seems to us the most complete tool of all we’ve used in our life lol.

If you don’t know what is GIT:

First step. INSTALL GIT.

Second step. GIT STRUCTURE

A simple way to see Git, it has several levels that are divide in:

  • Working directory: Our local project copy, where we are going to modify, create or erase files.
  • Staging area: Changes are ready to be uploaded to the repository, but they are still waiting.
  • Local repository: Staging changes pass to our local repository, but they are not upload to our remote repository.
  • Remote repository: Finally our code is the cloud, so we can clone it from any machine in the world.

When we do git init, it generates a hidden folder .git where all versions of your repository, at a basic level, are stored. That is our local repository directory, we can upload to the cloud through a remote server (usually call origin, but we can call it as we want and have several).We recommend GitHub repositories and Open Source BitBucket for private repositories. Basically in these repositories you will create an account, and they will offer space to host the repository in the cloud.

Within our repository we will create a main branch called master, fromwhich we can create more branches and then merge them when they are ready. The branches are a very interesting concept. These branches allow you to create parallel projects to the branch that we are working on developments, which later can rejoin (merge) to the parent branch. GRAPHIC EXAMPLE: a project has a master branch, where we find all final versions of the app. In this branch, get a DEVELOP branch, where developers are creating new functionalities of the app. When they finish their work, again merge with MASTER, so the boss can see the final versions and so he/she congratulates you for a well done job (SCIENCE FICTION).

When we want certain files (such as temporary files), and they are not stored in our repository, we can create a file in the repository root called .gitignore and then add the file or path you want to ignore. We advise you to include this file in the repository.The file .gitignore helps us especially to avoid uploading files to the repository to create conflicts in other machines because it may contain files directly related to the development environment, pointing to paths of a particular machine, etc.

We have multiple models available .gitignore files at

Third step. USE GIT

To compress some things in this post we will talk about using git via console commands, the “primitive” way to use git. You can also use git with different graphical environments, but we will explain in another post.

Git commands that are more useful in our opinion:

  • git init – Creates a git repository in the folder where we have executed the command.
  • git remote add <repository_remote_name> <url_repository>  – Add a remote repository.
  • git clone <url_repository>  – Allows to clone (download) a repository in the current folder.
  • git status  – Inform us about the status of our files in the repository. Which of them are new, modify or created but not added to the repository (untracked)
  • git add <file>  – Add untracked files to the repository.
  • git add .  – Add all the untracked files.
  • git rm <file>  –  Removes a file from the repository.
  • git rm --cached <file>  – Returns a file to untracked state. If we want to remove it from the following commits, we will need to include this file in the .gitignore.
  • git commit -m "message"  – Upload changes to the local repository.
  • git push <remote_repository_name> <branch_name>  – Upload the files from the local repository to the remote repository.
  • git checkout -b <branch_name>  – Create a new branch, which borns in the current branch, and move our local copy to the new branch.
  • git branch <branch_name>  – Create a new branch from the current branch.
  • git branch -d <branch_name>  – Borrar una rama.
  • git pull <repository_name> <branch_name>  – Updates de local repository with the changes of the remote repository.
  • git merge <branch_name_to_merge>  – Join changes from the branch that we are calling in the current branch.
  • git fetch <repository_name> <branch_name>  – Update the state for the remote repository.
  • git reset --hard  – Remove all changes, files untracked, modify files…
  • git help  – Git default help(only for people who don’t use this guide).

Official GIT doc

GIT cheatsheet

Free introductory course to GIT

Git Tutorial: A Comprehensive Guide


Thanks people!