зеркало из https://github.com/microsoft/git.git
18 строки
378 B
Bash
Executable File
18 строки
378 B
Bash
Executable File
#!/bin/sh
|
|
|
|
. git-sh-setup-script || die "Not a git archive"
|
|
|
|
branchname="$1"
|
|
case "$2" in
|
|
'')
|
|
head=HEAD ;;
|
|
*)
|
|
head="$2^0" ;;
|
|
esac
|
|
rev=$(git-rev-parse --revs-only --verify "$head") || exit
|
|
|
|
[ -z "$branchname" ] && die "git branch: I want a branch name"
|
|
[ -e "$GIT_DIR/refs/heads/$branchname" ] && die "$branchname already exists"
|
|
|
|
echo $rev > "$GIT_DIR/refs/heads/$branchname"
|