#!/usr/bin/env bash # reset_demo_repo.sh # # Clones the gitaec.org demo repo into a temp directory, strips unwanted IFC # files, resets OPERATIONS.md, squashes all history into a single "init" commit, # and force-pushes to origin. # # Files kept in ifc/: duplex.ifc office.ifc # History: replaced with a single initial commit set -euo pipefail DEMO_REPO="https://gitaec.org/rvba/ifc-commit-demo.git" echo "⚠️ WARNING: This will erase ALL git history of the demo repo." echo " Repo : $DEMO_REPO" echo " Kept : ifc/duplex.ifc ifc/office.ifc yaml/" echo " Removed: OPERATIONS.md (if present)" echo "" read -r -p "Type 'yes' to proceed: " CONFIRM if [ "$CONFIRM" != "yes" ]; then echo "Aborted." exit 1 fi echo "" WORK_DIR="$(mktemp -d)" cleanup() { rm -rf "$WORK_DIR" } trap cleanup EXIT echo "==> Cloning demo repo into $WORK_DIR" git clone "$DEMO_REPO" "$WORK_DIR/demo" cd "$WORK_DIR/demo" echo "==> Removing unwanted IFC files from ifc/" if [ -d ifc ]; then find ifc -maxdepth 1 -name "*.ifc" \ ! -name "duplex.ifc" \ ! -name "office.ifc" \ -delete echo " Kept: $(ls ifc/*.ifc 2>/dev/null | xargs -n1 basename | tr '\n' ' ')" else echo " WARNING: ifc/ directory not found — skipping IFC cleanup" fi echo "==> Keeping yaml/ directory intact" if [ ! -d yaml ]; then echo " WARNING: yaml/ directory not found" fi echo "==> Removing OPERATIONS.md and ifc/history.json" rm -f OPERATIONS.md ifc/history.json echo "==> Switching to orphan branch to drop all history" git checkout --orphan fresh-start echo "==> Staging all remaining files" git add -A echo "==> Creating single initial commit" git commit -m "init: fresh demo repo" echo "==> Force-pushing to origin as main" git push --force origin fresh-start:main echo "" echo "Done. Demo repo history has been reset." echo "Verify at: https://gitaec.org/rvba/ifc-commit-demo"