Skip to content

Instantly share code, notes, and snippets.

@BlinkyStitt
Created May 20, 2024 17:41
Show Gist options
  • Save BlinkyStitt/ac57759e76b3d8675e212312c1e122fc to your computer and use it in GitHub Desktop.
Save BlinkyStitt/ac57759e76b3d8675e212312c1e122fc to your computer and use it in GitHub Desktop.
~/.git-hooks/post-commit
#!/bin/bash
echo "🧘 Breath in. 🧘 Breath out. 🧘 Say cheese! 😁"
# Directory to store images and repo names
STORAGE_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs/Documents/Gitshots"
# Ensure the storage directory exists
mkdir -p "$STORAGE_DIR"
# Get the name of the repository
REPO_NAME=$(basename "$(git rev-parse --show-toplevel)")
IMAGE_PATH="$STORAGE_DIR/${REPO_NAME}-$(date +%Y-%m-%d-%H%M%S).png"
# Take a photo with timestamp
echo "Saving image to ${IMAGE_PATH}"
imagesnap "${IMAGE_PATH}" >/dev/null &
# Continue the commit
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment