summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git_rebase_illustrated_with_time_travel-1.pngbin0 -> 1899 bytes
-rw-r--r--git_rebase_illustrated_with_time_travel-2.pngbin0 -> 2616 bytes
-rw-r--r--git_rebase_illustrated_with_time_travel-3.pngbin0 -> 2219 bytes
-rw-r--r--git_rebase_illustrated_with_time_travel-4.pngbin0 -> 2467 bytes
-rw-r--r--git_rebase_illustrated_with_time_travel-5.pngbin0 -> 3119 bytes
-rw-r--r--git_rebase_illustrated_with_time_travel.html56
-rw-r--r--index.html2
7 files changed, 58 insertions, 0 deletions
diff --git a/git_rebase_illustrated_with_time_travel-1.png b/git_rebase_illustrated_with_time_travel-1.png
new file mode 100644
index 0000000..df1ec17
--- /dev/null
+++ b/git_rebase_illustrated_with_time_travel-1.png
Binary files differ
diff --git a/git_rebase_illustrated_with_time_travel-2.png b/git_rebase_illustrated_with_time_travel-2.png
new file mode 100644
index 0000000..f0042ca
--- /dev/null
+++ b/git_rebase_illustrated_with_time_travel-2.png
Binary files differ
diff --git a/git_rebase_illustrated_with_time_travel-3.png b/git_rebase_illustrated_with_time_travel-3.png
new file mode 100644
index 0000000..fdff17e
--- /dev/null
+++ b/git_rebase_illustrated_with_time_travel-3.png
Binary files differ
diff --git a/git_rebase_illustrated_with_time_travel-4.png b/git_rebase_illustrated_with_time_travel-4.png
new file mode 100644
index 0000000..d3bab7d
--- /dev/null
+++ b/git_rebase_illustrated_with_time_travel-4.png
Binary files differ
diff --git a/git_rebase_illustrated_with_time_travel-5.png b/git_rebase_illustrated_with_time_travel-5.png
new file mode 100644
index 0000000..3f5d437
--- /dev/null
+++ b/git_rebase_illustrated_with_time_travel-5.png
Binary files differ
diff --git a/git_rebase_illustrated_with_time_travel.html b/git_rebase_illustrated_with_time_travel.html
new file mode 100644
index 0000000..ebfc19f
--- /dev/null
+++ b/git_rebase_illustrated_with_time_travel.html
@@ -0,0 +1,56 @@
+<!doctype html>
+<html lang="en">
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="author" content="aki">
+<meta name="tags" content="git, rebase, branching, guide, time travel">
+<link rel="icon" type="image/png" href="cylo.png">
+<link rel="stylesheet" href="style.css">
+
+<title>Git Rebase Illustrated With Time Travel</title>
+
+<nav><p><a href="https://ignore.pl">ignore.pl</a></p></nav>
+
+<article>
+<h1>Git Rebase Illustrated With Time Travel</h1>
+<p class="subtitle">Published on 2022-01-28 16:43:00+01:00
+<p>Back in the office days, colleagues and I would have weekly discussions about git which usually ended with comparing
+merge to rebase or with me preaching about the dangers of rewriting the history. Let's go back to these times but with
+a slight twist. There's already plenty of other in-depth git tutorials and <b>git-rebase</b>(1) is great and you should
+read it. There is no point in creating yet another resource, so instead let's make it a fun and chill weekend read.
+<p>Let's say two different people are working on two completely disconnected task in parallel in a known period. These
+tasks can be divided into a sequence of sub-tasks, where each sub-tasks enables next sub-task to be performed and there
+is no room for parallelization (for now). This situation can be illustrated like this:</p>
+<img src="git_rebase_illustrated_with_time_travel-1.png" alt="original timeline">
+<p>In the graph <strong>A</strong> and <strong>B</strong> lanes represent the progress of a task with significant points
+in sub-tasks. All sub-tasks can be projected into the time line and their order remains the same.
+<p>Let's expand the example by adding two common spots in time for both tasks: first being someone ordering to perform
+both tasks, and second being the merge of both lanes into one.</p>
+<img src="git_rebase_illustrated_with_time_travel-2.png" alt="timeline with common tasks">
+<p>This should look somehow similar to you, because (if not for the missing middle part) this graph represents a regular
+workflow that uses <b>git-merge</b>(1). <strong>C</strong> is a common origin and goal for both task lanes and serves
+the same purpose as <code>master</code> branch.
+<p>In order to reduce the number of lanes we can let one of the tasks claim the main lane for their own. This happens
+when you branch off an active branch that gets some additional work done before you merge back into it:</p>
+<img src="git_rebase_illustrated_with_time_travel-3.png" alt="branch off and back">
+<p>This image was probably recognized by you right away.
+<p>Now, it just happened, but turns out that by the end of the <strong>A</strong> task the person responsible for it
+built a time machine and proposed to the project management to use it in order to perform both tasks sequentially but in
+parallel time. They were as confused as you are but gave green light just to see what happens.
+<p>Developer took the results of <strong>B</strong> with them and went back in time to the spot where <strong>A</strong>
+and <strong>B</strong> diverged. They started to work on <strong>A</strong> using the souvenir from the future as the
+<em>base</em>. People that were working on task <strong>B</strong> in the meantime were confused.
+<p>When the moment for merge came, the traveller from future just presented their work and said that it's already
+merged, so there's no need to do anything. And they spoke truthfully, because in linear time the work looked like this:
+</p>
+<img src="git_rebase_illustrated_with_time_travel-4.png" alt="rebase in linear timeline">
+<p>But from the perspective of the traveller the whole timeline got distorted and didn't look linear at all:</p>
+<img src="git_rebase_illustrated_with_time_travel-5.png" alt="rebase in non-linear timeline">
+<p>From this point of view the sequence is one-lane and completely undisturbed. On the other time the timeline gets
+shifted and some parts of it fade away as they never were or are no longer observed by the time traveller.
+<p>All of this happens every time you rebase your branches.
+<p>I hope you had fun and if you actually had some problems imagining what rebase does, I hope this post at least
+pointed you in the right direction.
+<p>Who knows maybe next time I'll write about more history rewriting shenanigans.
+</article>
+<script src="https://stats.ignore.pl/track.js"></script>
diff --git a/index.html b/index.html
index f187dd2..dc2497f 100644
--- a/index.html
+++ b/index.html
@@ -33,6 +33,8 @@
<section id="blog">
<h2>Blog</h2>
<ul>
+<li> <a href="git_rebase_illustrated_with_time_travel.html">Git Rebase Illustrated With Time Travel</a><br>
+ <time>2022-01-28</time>
<li> <a href="you_can_serve_static_data_over_http.html">You Can Serve Static Data Over HTTP</a><br>
<time>2022-01-27</time>
<li> Renamed article from yesterday and fixed some typos around the place.<br>