An Overview of Git States and Transitions

A picture is worth a thousand words

I created this picture when I was first learning Git. It emphasises the different states that a line in a file can be in, and the ways of moving between those states.

I've noticed that many Git beginners don't make good use of the staging area, and simply do git add followed by git commit at all times. This picture should help with getting over that hurdle.

If you want to read the words in the picture, right-click it and open the image in a new tab.

Note the following:

  • Some of the words with a grey background may be out of date.
  • The colour has meaning — green for things on your local machine and blue for things on the remote.