post-receive
Bourne-Again shell script, ASCII text executable
1#!/bin/bash 2 3while read oldrev newrev refname 4do 5# Check if the refname starts with "refs/heads/" 6if [[ $refname == refs/heads/* ]]; then 7# Extract the branch name from refname 8branchname="${refname#refs/heads/}" 9 10# Change to the repository's working tree 11cd /path/to/your/repo/working/tree 12 13# Update the working tree for the branch 14git checkout -f "$branchname" 15fi 16done 17