Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
0b427693
G
git
项目概览
李少辉-开发者
/
git
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
git
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b427693
编写于
11月 18, 2005
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branches 'jc/branch' and 'jc/rebase'
上级
f9039f30
eb777612
7f59dbbb
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
34 addition
and
63 deletion
+34
-63
git-branch.sh
git-branch.sh
+18
-7
git-rebase.sh
git-rebase.sh
+16
-56
未找到文件。
git-branch.sh
浏览文件 @
0b427693
...
...
@@ -3,7 +3,7 @@
.
git-sh-setup
||
die
"Not a git archive"
usage
()
{
echo
>
&2
"usage:
$(
basename
$0
)
"
' [-d <branch>] | [<branch> [start-point]]
echo
>
&2
"usage:
$(
basename
$0
)
"
' [-d <branch>] | [
[-f]
<branch> [start-point]]
If no arguments, show available branches and mark current branch with a star.
If one argument, create a new branch <branchname> based off of current HEAD.
...
...
@@ -12,11 +12,12 @@ If two arguments, create a new branch <branchname> based off of <start-point>.
exit
1
}
headref
=
$(
GIT_DIR
=
"
$GIT_DIR
"
git-symbolic-ref HEAD |
sed
-e
's|^refs/heads/||'
)
delete_branch
()
{
option
=
"
$1
"
shift
headref
=
$(
GIT_DIR
=
"
$GIT_DIR
"
git-symbolic-ref HEAD |
sed
-e
's|^refs/heads/||'
)
for
branch_name
do
case
",
$headref
,"
in
...
...
@@ -52,6 +53,7 @@ delete_branch () {
exit
0
}
force
=
while case
"
$#,$1
"
in
0,
*
)
break
;;
*
,-
*
)
;;
*
)
break
;;
esac
do
case
"
$1
"
in
...
...
@@ -59,6 +61,9 @@ do
delete_branch
"
$@
"
exit
;;
-f
)
force
=
"
$1
"
;;
--
)
shift
break
...
...
@@ -72,8 +77,6 @@ done
case
"$#"
in
0
)
headref
=
$(
GIT_DIR
=
"
$GIT_DIR
"
git-symbolic-ref HEAD |
sed
-e
's|^refs/heads/||'
)
git-rev-parse
--symbolic
--all
|
sed
-ne
's|^refs/heads/||p'
|
sort
|
...
...
@@ -97,10 +100,18 @@ branchname="$1"
rev
=
$(
git-rev-parse
--verify
"
$head
"
)
||
exit
[
-e
"
$GIT_DIR
/refs/heads/
$branchname
"
]
&&
die
"
$branchname
already exists."
git-check-ref-format
"heads/
$branchname
"
||
die
"we do not like '
$branchname
' as a branch name."
if
[
-e
"
$GIT_DIR
/refs/heads/
$branchname
"
]
then
if
test
''
=
"
$force
"
then
die
"
$branchname
already exists."
elif
test
"
$branchname
"
=
"
$headref
"
then
die
"cannot force-update the current branch."
fi
fi
git update-ref
"refs/heads/
$branchname
"
$rev
git-rebase.sh
浏览文件 @
0b427693
...
...
@@ -5,65 +5,25 @@
.
git-sh-setup
||
die
"Not a git archive."
usage
=
"usage:
$0
"
'<upstream> [<head>]
Uses output from git-cherry to rebase local commits to the new head of
upstream tree.'
case
"
$#,$1
"
in
1,
*
..
*
)
upstream
=
$(
expr
"
$1
"
:
'\(.*\)\.\.'
)
ours
=
$(
expr
"
$1
"
:
'.*\.\.\(.*\)$'
)
set
x
"
$upstream
"
"
$ours
"
shift
;;
esac
# The other head is given
other
=
$(
git-rev-parse
--verify
"
$1
^0"
)
||
exit
# The tree must be really really clean.
git-update-index
--refresh
||
exit
diff
=
$(
git-diff-index
--cached
--name-status
-r
HEAD
)
case
"
$different
"
in
?
*
)
echo
"
$diff
"
exit
1
;;
esac
# If the branch to rebase is given, first switch to it.
case
"$#"
in
1
)
ours_symbolic
=
HEAD
;;
2
)
ours_symbolic
=
"
$2
"
;;
*
)
die
"
$usage
"
;;
2
)
git-checkout
"
$2
"
||
exit
esac
upstream
=
`
git-rev-parse
--verify
"
$1
"
`
&&
ours
=
`
git-rev-parse
--verify
"
$ours_symbolic
"
`
||
exit
different1
=
$(
git-diff-index
--name-only
--cached
"
$ours
"
)
&&
different2
=
$(
git-diff-index
--name-only
"
$ours
"
)
&&
test
"
$different1$different2
"
=
""
||
die
"Your working tree does not match
$ours_symbolic
."
git-read-tree
-m
-u
$ours
$upstream
&&
new_head
=
$(
git-rev-parse
--verify
"
$upstream
^0"
)
&&
git-update-ref HEAD
"
$new_head
"
||
exit
tmp
=
.rebase-tmp
$$
fail
=
$tmp
-fail
trap
"rm -rf
$tmp
-*"
1 2 3 15
>
$fail
git-cherry
-v
$upstream
$ours
|
while
read
sign commit msg
do
case
"
$sign
"
in
-
)
echo
>
&2
"* Already applied:
$msg
"
continue
;;
esac
echo
>
&2
"* Applying:
$msg
"
S
=
$(
git-rev-parse
--verify
HEAD
)
&&
git-cherry-pick
--replay
$commit
||
{
echo
>
&2
"* Not applying the patch and continuing."
echo
$commit
>>
$fail
git-reset
--hard
$S
}
done
if
test
-s
$fail
then
echo
>
&2 Some commits could not be rebased, check by hand:
cat
>
&2
$fail
echo
>
&2
"(the same list of commits are found in
$tmp
)"
exit
1
else
rm
-f
$fail
fi
# Rewind the head to "$other"
git-reset
--hard
"
$other
"
git-format-patch
-k
--stdout
--full-index
"
$other
"
ORIG_HEAD |
git am
--binary
-3
-k
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录