Using Git Hook post-flow-feature-start on window, create a directory with the name of the feature

27 Views Asked by At

I need to create a directory named after the branch name created with the git command .

So I was planning to use post-flow-feature-start hook to excute a MKdir command but I can't find a way to get the name of branch in variable to pas to the Mkdir command.

thk

1

There are 1 best solutions below

0
sudavid4 On

looking at their example I would suppose that $3 contains the branch name. So you would write this:

branchname="$3"
toplevel=$(git rev-parse --show-toplevel)
newdir="$toplevel"/"$branchname"
if [[ -d "$newdir" ]]; then
    echo directory "$newdir" already exists
    exit 1
fi
mkdir "$newdir"