My work can time-travel?

Normally, work only counts if you base it on the latest version of a document. Git lets you move work through time, which allows you to structure your work in new and productive ways. In this section, we'll explore the mechanics which make this possible.

We'll start by explaining how to merge two streams of work. Next, we'll explain how you can extract the essence of a change into a patch, which you can use to transplant your work into the past or the future. To make this time-travel more concrete, we'll move and undo a single commit, and then take the next natural step to move an entire branch.

Lastly, we'll consider whether it's a good idea to rewrite history. Whether it is or is not a good idea, we'll learn how to do it.

So, let's start with the most common and reliable tool for time-travel: the merge.