File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 99--------
1010[verse]
1111'git-branch' [-r]
12- 'git-branch' [-f] <branchname> [<start-point>]
12+ 'git-branch' [-l] [- f] <branchname> [<start-point>]
1313'git-branch' (-d | -D) <branchname>...
1414
1515DESCRIPTION
@@ -23,7 +23,8 @@ If no <start-point> is given, the branch will be created with a head
2323equal to that of the currently checked out branch.
2424
2525With a `-d` or `-D` option, `<branchname>` will be deleted. You may
26- specify more than one branch for deletion.
26+ specify more than one branch for deletion. If the branch currently
27+ has a ref log then the ref log will also be deleted.
2728
2829
2930OPTIONS
@@ -34,6 +35,11 @@ OPTIONS
3435-D::
3536 Delete a branch irrespective of its index status.
3637
38+ -l::
39+ Create the branch's ref log. This activates recording of
40+ all changes to made the branch ref, enabling use of date
41+ based sha1 expressions such as "<branchname>@{yesterday}".
42+
3743-f::
3844 Force the creation of a new branch even if it means deleting
3945 a branch that already exists with the same name.
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- USAGE=' [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'
3+ USAGE=' [-l] [ (-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'
44LONG_USAGE=' If no arguments, show available branches and mark current branch with a star.
55If one argument, create a new branch <branchname> based off of current HEAD.
66If two arguments, create a new branch <branchname> based off of <start-point>.'
@@ -42,6 +42,7 @@ If you are sure you want to delete it, run 'git branch -D $branch_name'."
4242 esac
4343 ;;
4444 esac
45+ rm -f " $GIT_DIR /logs/refs/heads/$branch_name "
4546 rm -f " $GIT_DIR /refs/heads/$branch_name "
4647 echo " Deleted branch $branch_name ."
4748 done
@@ -55,6 +56,7 @@ ls_remote_branches () {
5556}
5657
5758force=
59+ create_log=
5860while case " $# ,$1 " in 0,* ) break ;; * ,-* ) ;; * ) break ;; esac
5961do
6062 case " $1 " in
6971 -f)
7072 force=" $1 "
7173 ;;
74+ -l)
75+ create_log=" yes"
76+ ;;
7277 --)
7378 shift
7479 break
117122 die " cannot force-update the current branch."
118123 fi
119124fi
125+ if test " $create_log " = ' yes'
126+ then
127+ mkdir -p $( dirname " $GIT_DIR /logs/refs/heads/$branchname " )
128+ touch " $GIT_DIR /logs/refs/heads/$branchname "
129+ fi
120130git update-ref -m " branch: Created from $head " " refs/heads/$branchname " $rev
You can’t perform that action at this time.
0 commit comments