Created
February 6, 2010 17:34
-
-
Save howardjp/296845 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Script by Wesley J. Landaker <wjl@icecavern.net> | |
# posted to git@vger.kernel.org on 5 Feb 2010. | |
# | |
# Besides the error checking, this just creates a new ref | |
# and clears the index so you can start from a clean slate. | |
# No actual files are deleted from the work-tree. | |
if [ $# -ne 1 ]; then | |
2<&1 | |
echo "usage: git emptybranch <new_branch>" | |
exit 1 | |
fi | |
if ! git check-ref-format refs/heads/"$1"; then | |
2<&1 | |
echo "fatal: '$1' is not a valid branch name." | |
exit 1 | |
fi | |
git symbolic-ref -m "git emptybranch $1" HEAD refs/heads/"$1" | |
git rm --cached -r -q --ignore-unmatch -- '*' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment