Is git occasionally (or often) a mystery to you? - You are not alone! I have pulled in a few hand picked resources, in this post you get the first few bite-sized lessons.
A former client adopted git recently and not everyone there knew distributed version control all that well. To bring them up to speed I created a set of small “lessons” pointing to good resources. After a few lessons I promise that you will have fewer git-induced headaches.
Each lesson typically contains a link to a video, a blog post, or something similar. There will be content for all levels, both beginners and those more experienced. I even think the odd expert might find a tip or two.
Lesson 1 - What is git?
First lesson is very basic (but short) and if you have used git more than a little you can skip this, but stick around for lesson 2.
The video is by Matthew McCullough from GitHub.
Themes in Lesson 1:
- What’s the point of version control?
- What does it mean that git is ‘distributed’?
- A few examples of basic and more advanced use
Lesson 2 - Understanding Git
This lesson is presented by a slightly hung over Steve Smith from Atlasssian. The talk was held at the Devoxx conference in Antwerp in November 2015.
Steve will help you understand the underlying concepts of git. Some of this could be regarded as implementation details, but understanding these concepts will help you a lot.
The video takes about 45 minsutes to watch, and more to digest. If you find the topics too complicated, I promise we will approach these subjects later, from different angles.
Themes in lesson 2
- Fundamental data structure: commit, tree, blob
- HEAD, refs, tags
- Merge, fast-forward,
- Merge strategies
Lesson 3 - RTFM
A slightly provocative title (with a touch of 1337; RTFM = Read the f *** ing manual!).
But sometimes that can be a great tip. In git’s case is manual is fairly well-written. I have opted to show you a manual page that isn’t too action-packed, let still has a few surprises:
The goals of this lesson:
1) You should know
git add better, and
2) be more familiar with the f… manual …
Here are some arguments (to
git add), ordered by how important I think they are:
- To specify multiple files with
dir(i.e. names of directory with the changed files)
- To specify multiple files
- Specifying files with globs:
-i(but rarely use this after I learned
Lesson 4 - Git from the Bottom Up
There are several open source books on git. The best known is probably Pro Git, which you can download as an eBook or read online.
However, for this lesson you only need to read the introduction from another open source book on git: Git from the Bottom Up. The first page contains definitions of the key terms you should know to read all other git documentation. Since we have already dug quite a bit deeper than this I suggest you use this as a checklist of terms you should be familiar with.
After this you should be able to explain:
- Working tree
- Relationship between repository, index and working tree
Lesson 5 - git cheat sheets
git has many commands - about 80 last I checked. In addition to the built-in ones you can create your own too. Some commands you will probably never use. E.g. try
git help bundle and read up on how git works over “sneaker net”.
There are many “cheat sheets” to help you find the more popular git commands. Cheat sheets are nice to have when you’re new, but also good to use as check lists when you are more experienced.
I have included links to a few different ones below.
This one is interactive: Git Cheatsheet (by NDP Software) http://ndpsoftware.com/git-cheatsheet.html
After this lesson, you should know which git-commands are the most used, and might also have picked up some new ones to learn.