I’ve recently returned back to work after short vacation and upon my return I had an opportunity to explain the usage of a few git commands to our engineering intern. Still being a bit jet lagged I thought of using airplane analogies in order to explain some of the git commands; they seemed to be a great way of showing the principles behind the powerful tool that is git.
This is intended to be an introductory material and does not cover all the intricate ways of using git or all of git commands. It just covers the commands that are used most often and can be explained in plane references with flying analogies. Without any further ado, let’s dive right in.
git add — passing the TSA precheck. As any person who passes the TSA checkpoint, the TSA validates that you don’t have any hazardous items with you and you are ready to enter the airport in order to board on a plane. The same happens with a file — after you have added it, it goes to the staging area (airport) and is ready to be commited (board the plane). In this metaphor — you as a developer — are responsible to do the TSA scan on your files, by using git status and git diff, to make sure that you only add the files you actually intend to commit.
git commit — boarding the plane.
git push — sending the airplane (local branch) into the clouds (remote repository).
git fetch — getting access to control tower, so you know what planes (branches) are in the air (remote repository), so you can call them in with git pull and/or let them land and have access to them with git checkout.
git pull — calling the plane (branch) that’s in the air (remote repository) to land, so you can access it locally.
The article is brief and to the point and contains some picturesque analogies that might be helpful to all folks starting their adventure with git.