jon-b of 9seeds
10/20/2014 - 3:46 PM

git-push branch to bare repository

git-push branch to bare repository

#!/bin/bash

# read the passed in args
read oldrev newrev ref

# find the branchname http://stackoverflow.com/a/13198980
branchname=${ref#refs/heads/}

# checkout the branch
git --work-tree=/path/to/code --git-dir=/path/to/bare.git checkout -f ${branchname}