No description
Find a file
2026-08-31 14:15:04 +02:00
LICENCE.md ram 2026-08-30 12:00:06 +02:00
ram Using GNU screen to protect against disconnects. 2026-08-31 14:15:04 +02:00
README.md Using GNU screen to protect against disconnects. 2026-08-31 14:15:04 +02:00

ram - High-Performance RAM Workspace for Git Repositories

ram is a lightweight Bash utility designed primarily for Linux systems and SBCs like the Raspberry Pi. It mounts a temporary workspace inside RAM (/dev/shm), drastically reducing SD card write wear and accelerating file operations and build/compilation times.


Key Features

  • GNU Screen Session Protection: Encapsulates the entire RAM session within GNU screen (ram-<repo-name>). If an SSH connection drops, network breaks, or the terminal window closes accidentally, the workspace and in-progress processes remain alive in RAM. Simply re-run ram (or screen -r) to reattach immediately.
  • SD Card Lifespan Protection: Intermediate build files (.o, build logs, binary artifacts) are generated inside RAM (tmpfs) and never touch the SD card.
  • Direct Git Proxy: Symlinks the .git directory back to disk. Every git commit, git branch, or git add executed inside RAM updates your on-disk repository instantly.
  • Smart .gitignore Filtering: Leverages rsync --filter=':- .gitignore' on exit:
    • Tracked source files & persistent untracked files (e.g. notes.txt, .env) are mirrored back to disk.
    • Ignored build artifacts are automatically scrapped when the session ends.
  • Safety Traps: Gracefully captures exit, Ctrl+D, Ctrl+C (SIGINT), SIGTERM, and terminal hangups (SIGHUP) to guarantee changes sync back before cleaning up RAM when exiting.
  • Visual Prompt Indicator: Spawns an interactive shell with a contextual prompt ([RAM:repo-name]) displaying paths relative to the project root when inside the RAM workspace, and standard paths when outside.
  • Quick Return (ram): Running ram without arguments inside the subshell acts like cd, quickly returning you to the root of the RAM workspace.

License

CC0 1.0 Universal (Public Domain Dedication). Feel free to use, modify, and share without restrictions!


Installation & Requirements

Ensure rsync and screen (GNU screen) are installed:

sudo apt install rsync screen

Drop the ram script somewhere in your PATH (e.g. ~/.local/bin/ram or /usr/local/bin/ram).

Navigate to any Git repository root and run ram (or run ram <path-to-repo>). If a session for that repository is already running (e.g. after an SSH disconnection), ram automatically reattaches to it!