Skip to content

Instantly share code, notes, and snippets.

@Glutexo
Created November 27, 2015 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Glutexo/75482ee215ed19e95f4f to your computer and use it in GitHub Desktop.
Save Glutexo/75482ee215ed19e95f4f to your computer and use it in GitHub Desktop.
Outputs git-big-picture to the “big-picture.svg” file every time something in a git repository changes.
#!/bin/sh
# Uses ruby to encode JSON, watchman to watch for changes, git-big-picture to output the image.
# Can be improved by watching only file creation/deletion, since content changes are irrelevant.
CURRENT_PATH=`pwd`
JSON=`HEADS_PATH="$CURRENT_PATH/.git/logs/refs/heads" ruby -e "require 'json'; puts JSON.dump ENV['HEADS_PATH']"`
watchman -j <<-EOT
["watch", $JSON]
EOT
watchman -j <<-EOT
["trigger", $JSON, {
"name": "big-picture",
"append_files": false,
"chdir": "../../../../",
"command": ["git", "big-picture", "-o", "big-picture.svg"]
}]
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment