docs for post commit hook with dirmd

This commit is contained in:
Bartal Laearsson
2026-08-08 13:55:14 +01:00
parent fa661300bf
commit bc2cc0b531
@@ -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`