WTF: Git

What is git?

Git is file version system. It keeps some sort of history of the modification of a particular file. You can time travel to a particular point in your history or manipulate it to help resolve conflict between file edit and file version.

Why use git?

For every file that requires iteration. I used it on code file but also on document and text. It is a good way to produce an history and some sort of backup of previous state of the document.

It is super usefull in team work to ensure that all the file a setup correctly and no conflict between.

How does git work?

You sepcify with file to include into the history and you commit the changes of this file. Internally it make the difference between the current and the past iteration of the file and stores the difference.

Github?

Github is not git. Git is the file version system. Github is the remote place where the history can be saved. Other services are available such as gitlab, bitbucket, etc

How do use it?

There are many visual tool but the simplest way is to use the command line. It takes some practice to know the commands but it will be ultimatly quicker.

When should I learn it?

Pretty soon in your developper journey. It is really used in the real world and it may save you some time later. I would recommand learning it before getting on a real project. If you are new to programming this may be a bit overwhelming so after a couple of tutorial is a good time to learn git.

Do you have an example?

In a shell where git is installed

$ git init
 Initialized empty Git repository in /Users/username/folder/gitTest/.git/
$ echo "This is the file content" > file.txt 
$ git add file.txt
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   file.txt

$ git commit -m "My first commit"