October 21, 2015 is approaching– the “future” in Back to the Future Part II. And while Marty McFly’s style of time travel is still science fiction, software developers engage in a sort of their own time travel everyday: git source control.
For fun, here’s the plot of the Back to the Future series, as 10 git concepts!
1. Fast-forward merge
Einstein the dog becomes the first time traveler by doing a git merge and fast-forwarding one commit.
2. Checkout a previous commit
Marty then goes back in time by doing a git checkout of a previous commit, made on November 5, 1955.
Of course, if you
git checkout a previous commit, that inevitably leads to…
3. Detached HEAD
4. Pull Request Accepted
Marty refactors some code…
After resolving merge conflicts, Marty’s changes to the timeline are accepted. When he returns to 1985, his life with Jennifer is the same and better… with a new truck!
5. Release branches
Doc, Marty, and Jennifer then checkout the release-2015 branch and try out flying cars and hoverboards, but also see an older, still insecure Marty manipulated into losing his job. Looks like they will want to make some changes before merging the release branch into
Unfortunately, Old Biff rebases the
master branch of the whole
hill-valley repo on top of a new 1955 commit that contains the sports almanac, just so he can include the features he wants.
7. Rebase Conflicts
However, Biff’s rebase causes a ton of conflicts when Marty and Doc return to a 1985 that is much different than what they expect.
8. Branch management
Doc and Marty figure out what happened, wishing everyone had just followed Git Flow. They now have to go all the way back to the first rebased commit,
5nov1955 again, to undo the conflicts.
9. Amending a commit
Doc and Marty are able to solve the rebase conflicts, but a lightning strike to the time machine sends Doc back to 1885, where he is killed by “Mad Dog” Tannen. To save him, Marty travels back to 1885, and he and Doc amend the commit where Doc was killed, then rebase everything on top of that (luckily, everything still works).
10. Code Reviews
Back in 1985, Jennifer wonders if her future with Marty has to be exactly what she witnessed on the
release-2015 branch. Luckily, Marty has learned from his code reviews with Doc and resists being manipulated into a car race that would have resulted in an accident. They decide that their future is not yet committed to
master, and to code the best future they can together.
Thank you for reading and have an excellent “Back to the Future Day” on October 21, 2015!