#!/bin/bash

while read oldrev newrev refname
do
    # Check if the refname starts with "refs/heads/"
    if [[ $refname == refs/heads/* ]]; then
        # Extract the branch name from refname
        branchname="${refname#refs/heads/}"

        # Change to the repository's working tree
        cd /path/to/your/repo/working/tree

        # Update the working tree for the branch
        git checkout -f "$branchname"
    fi
done
