0

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

Bernie
  • 23
  • 5

1 Answers1

0

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"
sudavid4
  • 1,081
  • 6
  • 14