Created
March 10, 2017 13:27
-
-
Save dasJ/527f27773ec93f000270183f6cd0cec8 to your computer and use it in GitHub Desktop.
git-emptybranch
This file contains hidden or 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/bash | |
# Create a git branch with a single commit that contains nothing. | |
if [ "${#}" != 1 ]; then | |
echo "Usage: ${0} [branch name]" | |
exit 1 | |
fi | |
tree="$(: | git mktree)" | |
commit="$(git commit-tree "${tree}" -m "Initial commit")" | |
git branch "${1}" "${commit}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment