Skip to content

Git Commit Image Snapshot

Daeinc edited this page Dec 14, 2023 · 5 revisions

Creative coding involves making a lot of small tweaks to the same codebase. Without a system in place, many of the unique and interesting visual outcomes are lost by overwriting the code. You can export images to keep records but it's hard to reproduce the same code. You can use Git to snapshot your code, but it's hard to find a commit when you have hundreds of snapshots.

Ssam uses vite-plugin-ssam-git to handle both at the same time by committing to Git to save the code snapshot and export an image with the commit hash, thus making it easy to reproduce the exact same code and the outcome. This feature was one of my favorites and most helpful from canvas-sketch.

How It Works

When you press Cmd(or Ctrl) + K, it will commit the current code snapshot to the local git repository and export an image with the commit hash. If you later decide to go back to one of the snapshots, you can use the hash to checkout the commit.

If the project directory is not already a Git repo. The plugin will run git init to set up a new one.

The Git commit and image snapshot only works in the Vite development server.

How To Disable

  1. In vite.config.js/ts file, remove the plugin ssamGit().
  2. You can also run npm uninstall vite-plugin-ssam-git.
Clone this wiki locally