#!/bin/sh echo "Executing post-receive script. (Located in the --bare repo's hooks folder.)" # Instructions: # Put this file into your .git/hooks folder and set as executable #- for Windows (attrib +x pre-commit) #- for ubuntu (chmod +x pre-commit) DEPLOYDIR=/k/Konstruktion/Neue_Projekt_Struktur-READ_ONLY/Projekt/Modelljahr/EL # The place to deploy to. BRANCH="main" read oldrev newrev ref # Only auto-deploy (checkout) the $BRANCH specified above. if [[ $ref = refs/heads/$BRANCH ]]; then echo "Branch $ref received. Deploying ${BRANCH} branch to \"$DEPLOYDIR\" folder." git --work-tree=$DEPLOYDIR checkout -f git log -n 10 --name-status > $DEPLOYDIR/top_commit.txt echo "Done." else echo "Branch $ref received. Doing nothing: only the ${BRANCH} branch may be auto-deployed to the \"$DEPLOYDIR\" folder." fi