GIT for pro

I had plans to write a solid and comprehensive guide book about the GIT and everything what is misleading for the user. Fortunately somebody else (John Wiegley) done it already. It's a really good piece of work and you can read it here: GIT from the bottom up (Only 30 pages! BTW I'm using his images on this page... Sorry and thanks John!)

Let me just quote the most important conclusions from his work:

  • GIT repository is contained always in one directory. If you make a copy you will get the same change history, settings and of course versions of your files.

  • GIT repositories are made of commits. Each commit holds a tree. Each tree can include another tree or a blob. A blob is almost like your file. As you can see a tree represents your directory of files.

Commits

  • GIT repository is a collection of commits with trees and blobs. That collection is a directed graph. Commits point to the parent. If a commit has more than one parent that means it's a merge. If it has more than one child it means a branch grown from it.

  • Tags are just named commits. Branches are also names for commits but they will move as the branch grows (branches have so called HEADs).

  • Commit, tree or a blob has an SHA1 which is calculated only from it's content. So if on two different computers the file in blob is identical they will have the same SHA1. Rather obvious thing but revolutionary for version revision systems.

  • If you can use an SHA1 in the git command you can also use a branch or tag name there!

  • Index is a staging entity. In my opinion it gives you too much freedom. You can ignore it by -a flag from the git-commit.

Index

  • git-reset command resets anything: head of you branch, state of you index, even working tree (dangerous).

"pro" in the title stands also for "a programmer".