summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 91dcdfd)
raw | patch | inline | side by side (parent: 91dcdfd)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Tue, 12 Jul 2005 04:30:23 +0000 (21:30 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Tue, 12 Jul 2005 04:30:23 +0000 (21:30 -0700) |
You can use it as
git branch <branchname> [start-point]
and it creates a new branch of name <branchname>. If a starting point
is specified, that will be where the branch is created, otherwise it
will be created at the current HEAD.
The sequence
git branch xyz abc
git checkout xyz
can also be written as
git checkout -b xyz abc
as per the previous commit.
git branch <branchname> [start-point]
and it creates a new branch of name <branchname>. If a starting point
is specified, that will be where the branch is created, otherwise it
will be created at the current HEAD.
The sequence
git branch xyz abc
git checkout xyz
can also be written as
git checkout -b xyz abc
as per the previous commit.
Makefile | patch | blob | history | |
git-branch-script | [new file with mode: 0755] | patch | blob |
diff --git a/Makefile b/Makefile
index 03ea1636a77abd66813553d21d6b2b2a004a6ef4..93479ae653f3c6d351957f8a7151f3e0d0a748cb 100644 (file)
--- a/Makefile
+++ b/Makefile
git-log-script git-shortlog git-cvsimport-script git-diff-script \
git-reset-script git-add-script git-checkout-script git-clone-script \
gitk git-cherry git-rebase-script git-relink-script git-repack-script \
- git-format-patch-script git-sh-setup-script git-push-script
+ git-format-patch-script git-sh-setup-script git-push-script \
+ git-branch-script
PROG= git-update-cache git-diff-files git-init-db git-write-tree \
git-read-tree git-commit-tree git-cat-file git-fsck-cache \
diff --git a/git-branch-script b/git-branch-script
--- /dev/null
+++ b/git-branch-script
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. git-sh-setup-script || die "Not a git archive"
+
+branchname="$1"
+rev=$(git-rev-parse --verify --default HEAD "$2"^0) || 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"