Skip to content
animorio
IT
Back to the library

Git rebase

SVG, TransitionsGSAP, CSS onlyMediumCompressed weight: Demo 6.6 KBGSAP 28 KBFreeDownload the zip

A git rebase, in a card on black, minimal style: main along the bottom with four commits, the purple branch above with three, started two commits earlier. “Rebase onto main” lets the thread go: the three commits lift, fly one after the other in an arc past the tip of main and land with a little give, each with its new hash, leaving their dashed outline for a moment where they were. “Undo rebase” puts everything back. Pointing at a commit says what it did.

The code

A folder that runs on its own: index.html, style.css, script.js and the libraries from a CDN. The React and Vue tabs hold the same demo as a ready component, which switches its animations off when it leaves the page.

<!doctype html>
<!--
  "Git rebase" from Animorio · https://animorio.com
  License: free on your own sites and your clients’ sites, paid work included.
  Not for resale, redistribution, templates or code collections · https://animorio.com/en/license/
-->
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Git rebase</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource-variable/mona-sans@5.3.0/wdth.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <main class="stage">
    <!-- a git rebase: the branch's three commits come away, fly over to the tip of main and re-attach one by one
         with a new hash, leaving their old outlines behind; Undo puts everything back -->
    <section class="rb" data-rb aria-label="Git rebase">
      <header class="rb__head">
        <strong>feature/search</strong>
        <span class="rb__clip"><span data-outstate>2 commits behind main</span></span>
      </header>
      <div class="rb__graph">
        <svg viewBox="0 0 300 132" data-svg role="group" aria-label="Commit graph">
          <line class="rb__main" x1="30" y1="100" x2="180" y2="100"></line>
          <path class="rb__link" data-link d=""></path>
          <g data-olds></g>
          <g data-mains></g>
          <g data-feats></g>
          <g class="rb__tag" data-tagmain><rect x="-17" y="-8" width="34" height="16" rx="8"></rect><text y="3.300">main</text></g>
          <g class="rb__tag rb__tag--feat" data-tagfeat><rect x="-22" y="-8" width="44" height="16" rx="8"></rect><text y="3.300">feature</text></g>
        </svg>
      </div>
      <p class="rb__info"><span class="rb__clip"><span data-outinfo>The branch started before main moved on.</span></span></p>
      <button type="button" class="rb__btn" data-go><span class="rb__clip"><span data-outgo>Rebase onto main</span></span></button>
    </section>
    <span class="live" aria-live="polite" data-live></span>

    <svg class="ghost" data-ghost viewBox="0 0 24 24" aria-hidden="true"><path d="M5 3.200 19.200 11l-6.300 1.600-3.300 5.900Z"></path></svg>
  </main>

  <script src="https://cdn.jsdelivr.net/npm/gsap@3.15.0/dist/gsap.min.js"></script>
  <script src="script.js"></script>
</body>
</html>

Playground

Change values, colours and text with the controls and watch the animation respond live. Or write in the code yourself. Then download the folder with your changes.

15 values to change

Works with Claude, Claude Code, ChatGPT, Cursor, VS Code, Windsurf, Codex, Gemini CLI

Or ask your AI assistant for it

With the Animorio connector, Claude Code, ChatGPT, Cursor or VS Code take it from here, guide included, and fit it into your project. Paste this request:

Take “Git rebase” from Animorio and fit it into my site
Platform licenseFree on your sites and your clients’ sites. Want it inside a website builder, a template platform or a client dashboard? There’s a license for agencies and platforms.

What it does

On black, a dark rounded card: “feature/search” and under it “2 commits behind main”. Then the graph: at the bottom a light line with four empty circles, the hashes “a1f”, “b22”, “d90”, “e5c” below and the label “main” on the last; from the second a purple thread climbs to three filled purple circles, “c41”, “9be”, “e07”, with the label “feature” on the last. Below, “The branch started before main moved on.” and the light button “Rebase onto main”. Tapping it the purple thread goes, the three commits lift slightly and a dashed outline stays where they were; then one after the other they fly in an arc to the right, past “e5c”, and land swelling for a moment: the hash above changes to “7d2”, “f38”, “0ac”. The thread comes back, now from the tip of main; the “feature” label has followed the last commit, the old outlines fade and at the top you read “Up to date, 3 commits ahead of main”. The button, now hollow, says “Undo rebase”: tapping it the three commits go back together with their earlier hashes. Pointing at a commit thickens its border and below comes “9be Search as you type”.

How it works

Positions as numbers

Every commit on the branch has an object with x, y and radius: the animation moves those numbers and at every frame circles, hashes, thread and label are redrawn from them.

The thread is recalculated

The branch’s path is a curve climbing from its starting commit and then straight from commit to commit: changing the starting point is enough to re-attach it to the tip of main.

The flight

The x goes from one place to the other smoothly, the y rises and falls halfway: together they make the arc. On arriving the radius swells and comes back on a spring.

The new hash

The hash changes when the commit lands, not before: that is the moment git writes it again.

Values to change

NameFileDefaultWhat it changes
ACCENTscript.js#b18cffThe colour of the branch.
PACEscript.js0.75How many seconds each commit takes to fly to its new place.
ARCscript.js26How many pixels the commit rises while flying.
LOOPscript.jstrueLeft alone, the demo’s pointer points at a commit, rebases and then undoes it.

Try them in the Playground

When to use it

In the documentation of a git tool or a code platform, in a course or an article explaining rebase, and in a developer’s portfolio. The same flight of circles from one line to another carries moving tasks between two sprints or appointments between two days.

On phones

The card is at most 348 pixels wide and about 300 tall: the graph is a drawing that narrows with it, hashes included. With a finger a tap on a commit shows its text, another removes it; the button is 44 pixels tall.

With reduced motion

No flight: on tapping the button the commits are in their new place at once with the new hash and the thread re-attached, and the texts change in one step. The demo’s pointer does not start.

Pitfalls

  • A rebase writes the commits again: that is why the hashes change. Showing them the same before and after would teach something false.
  • The circles take keyboard focus and carry a label with hash, branch and message; the end of the rebase is announced to screen readers.
  • The circles’ radius and position are animated as numbers and written to attributes: a scale on an SVG element would shift it.
  • The border width is animated in the style and not the attribute, because the CSS rule beats the attribute.
  • Hashes, messages and branch names are invented.

Libraries

GSAP 3.15.0, Mona Sans (font variabile) 5.3.0.

Compressed with gzip, the three demo files weigh 6.6 KB; the libraries: GSAP 28 KB.

Testing

Tested on 1 December 2026

  • Desktop: Done
  • Phone: Done
  • Reduced motion: Done
  • Safari on iPhone: To do

License

Use it in your own projects and in your clients’ projects. Do not resell it or redistribute it as is. GSAP stays under its own Standard license. Full license.

All animations