Created
April 8, 2010 17:22
-
-
Save oyvholm/360304 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 | |
# git-eb | |
# File ID: 45c7afa2-434a-11df-8880-90e6ba3022ac | |
# | |
# Create new and unconnected branch | |
# usage: git eb <newbranch> | |
[ -z "$1" ] && { echo "usage: git eb <newbranch>" >&2; exit 1; } | |
[ -d ".git/." ] || { echo "git-eb: has to be executed from the top level of the tree" >&2; exit 1; } | |
[ -e ".git/refs/heads/$1" ] && { echo "git-eb: ref \"$1\" already exists" >&2; exit 1; } | |
git symbolic-ref HEAD refs/heads/"$1" | |
rm -f .git/index | |
git commit --allow-empty -m "Initial commit" |
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
[alias] | |
# eb = empty, not connected branch | |
eb = "!sh -c 'git symbolic-ref HEAD refs/heads/\"$1\"; rm .git/index; git clean -fdx; git commit --allow-empty -m \"Initial commit\"' -" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment