Skip to content

Instantly share code, notes, and snippets.

@nu7hatch
Created January 26, 2011 13:57
Show Gist options
  • Save nu7hatch/796713 to your computer and use it in GitHub Desktop.
Save nu7hatch/796713 to your computer and use it in GitHub Desktop.
Create empty git branch
#!/bin/bash
if [ $# -gt 0 ]; then
git symbolic-ref HEAD refs/heads/$1 &&
rm .git/index &&
git clean -fdx &&
git commit --allow-empty -m "Created empty $1 branch"
else
echo "No branch name specified!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment