From bc2cc0b53126e0fef1df4e3a2ed6bd1bd1e0dcf8 Mon Sep 17 00:00:00 2001 From: Bartal Laearsson Date: Sat, 8 Aug 2026 13:55:14 +0100 Subject: [PATCH] docs for post commit hook with dirmd --- docs/ADDING_DIRMD_TO_GIT_POST_COMMIT_HOOKS.md | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/ADDING_DIRMD_TO_GIT_POST_COMMIT_HOOKS.md diff --git a/docs/ADDING_DIRMD_TO_GIT_POST_COMMIT_HOOKS.md b/docs/ADDING_DIRMD_TO_GIT_POST_COMMIT_HOOKS.md new file mode 100644 index 0000000..6163035 --- /dev/null +++ b/docs/ADDING_DIRMD_TO_GIT_POST_COMMIT_HOOKS.md @@ -0,0 +1,24 @@ +# Automating sending files to proton drive on commits + +If you add this to any repos, and have dirmd in path and logged in on proton drive cli, then after each commit the newest code is pushed to proton drive, as vertical slices. If you do not want vertical slices of the code omit --vertical-slices. Also check out the other flags of dirmd if required. + +## repos-root/.git/hooks/post-commit + +create this file + +```sh +#!/bin/bash + +set -euo pipefail + +if ! command -v dirmd &>/dev/null; then + exit 0 +fi + +REPO_ROOT=$(git rev-parse --show-toplevel) +REPO_NAME=$(basename "$REPO_ROOT") + +dirmd -o "/tmp/${REPO_NAME}_new" "$REPO_ROOT" -f --vertical-slices --proton-drive +``` + +and then make it executable with something like `chmod +x .git/hooks/post-commit`