Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
1ef9e05d
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,发现更多精彩内容 >>
提交
1ef9e05d
编写于
6月 26, 2006
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'jc/squash'
* jc/squash: git-merge --squash
上级
6a0dbb8a
7d0c6887
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
24 deletion
+72
-24
Documentation/merge-options.txt
Documentation/merge-options.txt
+8
-0
git-commit.sh
git-commit.sh
+5
-2
git-merge.sh
git-merge.sh
+53
-19
git-pull.sh
git-pull.sh
+5
-2
git-reset.sh
git-reset.sh
+1
-1
未找到文件。
Documentation/merge-options.txt
浏览文件 @
1ef9e05d
...
...
@@ -6,6 +6,14 @@
not autocommit, to give the user a chance to inspect and
further tweak the merge result before committing.
--squash::
Produce the working tree and index state as if a real
merge happened, but do not actually make a commit or
move the `HEAD`, nor record `$GIT_DIR/MERGE_HEAD` to
cause the next `git commit` command to create a merge
commit. This allows you to create a single commit on
top of the current branch whose effect is the same as
merging another branch (or more in case of an octopus).
-s <strategy>, \--strategy=<strategy>::
Use the given merge strategy; can be supplied more than
...
...
git-commit.sh
浏览文件 @
1ef9e05d
...
...
@@ -566,6 +566,9 @@ then
elif
test
-f
"
$GIT_DIR
/MERGE_HEAD"
&&
test
-f
"
$GIT_DIR
/MERGE_MSG"
then
cat
"
$GIT_DIR
/MERGE_MSG"
elif
test
-f
"
$GIT_DIR
/SQUASH_MSG"
then
cat
"
$GIT_DIR
/SQUASH_MSG"
fi
| git-stripspace
>
"
$GIT_DIR
"
/COMMIT_EDITMSG
case
"
$signoff
"
in
...
...
@@ -663,7 +666,7 @@ else
fi
if
[
"
$?
"
!=
"0"
-a
!
-f
"
$GIT_DIR
/MERGE_HEAD"
-a
-z
"
$amend
"
]
then
rm
-f
"
$GIT_DIR
/COMMIT_EDITMSG"
rm
-f
"
$GIT_DIR
/COMMIT_EDITMSG"
"
$GIT_DIR
/SQUASH_MSG"
run_status
exit
1
fi
...
...
@@ -734,7 +737,7 @@ else
false
fi
ret
=
"
$?
"
rm
-f
"
$GIT_DIR
/COMMIT_MSG"
"
$GIT_DIR
/COMMIT_EDITMSG"
rm
-f
"
$GIT_DIR
/COMMIT_MSG"
"
$GIT_DIR
/COMMIT_EDITMSG"
"
$GIT_DIR
/SQUASH_MSG"
if
test
-d
"
$GIT_DIR
/rr-cache"
then
git-rerere
...
...
git-merge.sh
浏览文件 @
1ef9e05d
...
...
@@ -3,8 +3,7 @@
# Copyright (c) 2005 Junio C Hamano
#
USAGE
=
'[-n] [--no-commit] [-s <strategy>]... <merge-message> <head> <remote>+'
USAGE
=
'[-n] [--no-commit] [--squash] [-s <strategy>]... <merge-message> <head> <remote>+'
.
git-sh-setup
LF
=
'
...
...
@@ -42,20 +41,49 @@ restorestate() {
fi
}
finish_up_to_date
()
{
case
"
$squash
"
in
t
)
echo
"
$1
(nothing to squash)"
;;
''
)
echo
"
$1
"
;;
esac
dropsave
}
squash_message
()
{
echo
Squashed commit of the following:
echo
git-log
--no-merges
^
"
$head
"
$remote
}
finish
()
{
test
''
=
"
$2
"
||
echo
"
$2
"
case
"
$merge_msg
"
in
''
)
echo
"No merge message -- not updating HEAD"
case
"
$squash
"
in
t
)
echo
"Squash commit -- not updating HEAD"
squash_message
>
"
$GIT_DIR
/SQUASH_MSG"
;;
*
)
git-update-ref HEAD
"
$1
"
"
$head
"
||
exit
1
''
)
case
"
$merge_msg
"
in
''
)
echo
"No merge message -- not updating HEAD"
;;
*
)
git-update-ref HEAD
"
$1
"
"
$head
"
||
exit
1
;;
esac
;;
esac
case
"
$no_summary
"
in
case
"
$1
"
in
''
)
git-diff-tree
--stat
--summary
-M
"
$head
"
"
$1
"
;;
?
*
)
case
"
$no_summary
"
in
''
)
git-diff-tree
--stat
--summary
-M
"
$head
"
"
$1
"
;;
esac
;;
esac
}
...
...
@@ -66,6 +94,8 @@ do
-n
|
--n
|
--no
|
--no-
|
--no-s
|
--no-su
|
--no-sum
|
--no-summ
|
\
--no-summa
|
--no-summar
|
--no-summary
)
no_summary
=
t
;;
--sq
|
--squ
|
--squa
|
--squas
|
--squash
)
squash
=
t
no_commit
=
t
;;
--no-c
|
--no-co
|
--no-com
|
--no-comm
|
--no-commi
|
--no-commit
)
no_commit
=
t
;;
-s
=
*
|
--s
=
*
|
--st
=
*
|
--str
=
*
|
--stra
=
*
|
--strat
=
*
|
--strate
=
*
|
\
...
...
@@ -152,8 +182,7 @@ f,*)
?,1,
"
$1
"
,
*
)
# If head can reach all the merge then we are up to date.
# but first the most common case of merging one remote.
echo
"Already up-to-date."
dropsave
finish_up_to_date
"Already up-to-date."
exit
0
;;
?,1,
"
$head
"
,
*
)
...
...
@@ -205,8 +234,7 @@ f,*)
done
if
test
"
$up_to_date
"
=
t
then
echo
"Already up-to-date. Yeeah!"
dropsave
finish_up_to_date
"Already up-to-date. Yeeah!"
exit
0
fi
;;
...
...
@@ -310,11 +338,17 @@ case "$best_strategy" in
git-merge-
$best_strategy
$common
--
"
$head_arg
"
"
$@
"
;;
esac
for
remote
do
echo
$remote
done
>
"
$GIT_DIR
/MERGE_HEAD"
echo
"
$merge_msg
"
>
"
$GIT_DIR
/MERGE_MSG"
if
test
"
$squash
"
=
t
then
finish
else
for
remote
do
echo
$remote
done
>
"
$GIT_DIR
/MERGE_HEAD"
echo
"
$merge_msg
"
>
"
$GIT_DIR
/MERGE_MSG"
fi
if
test
"
$merge_was_ok
"
=
t
then
...
...
git-pull.sh
浏览文件 @
1ef9e05d
...
...
@@ -8,7 +8,7 @@ USAGE='[-n | --no-summary] [--no-commit] [-s strategy]... [<fetch-options>] <rep
LONG_USAGE
=
'Fetch one or more remote refs and merge it/them into the current HEAD.'
.
git-sh-setup
strategy_args
=
no_summary
=
no_commit
=
strategy_args
=
no_summary
=
no_commit
=
squash
=
while case
"
$#,$1
"
in
0
)
break
;;
*
,-
*
)
;;
*
)
break
;;
esac
do
case
"
$1
"
in
...
...
@@ -17,6 +17,8 @@ do
no_summary
=
-n
;;
--no-c
|
--no-co
|
--no-com
|
--no-comm
|
--no-commi
|
--no-commit
)
no_commit
=
--no-commit
;;
--sq
|
--squ
|
--squa
|
--squas
|
--squash
)
squash
=
--squash
;;
-s
=
*
|
--s
=
*
|
--st
=
*
|
--str
=
*
|
--stra
=
*
|
--strat
=
*
|
--strate
=
*
|
\
--strateg
=
*
|
--strategy
=
*
|
\
-s
|
--s
|
--st
|
--str
|
--stra
|
--strat
|
--strate
|
--strateg
|
--strategy
)
...
...
@@ -100,4 +102,5 @@ case "$strategy_args" in
esac
merge_name
=
$(
git-fmt-merge-msg <
"
$GIT_DIR
/FETCH_HEAD"
)
||
exit
git-merge
$no_summary
$no_commit
$strategy_args
"
$merge_name
"
HEAD
$merge_head
git-merge
$no_summary
$no_commit
$squash
$strategy_args
\
"
$merge_name
"
HEAD
$merge_head
git-reset.sh
浏览文件 @
1ef9e05d
...
...
@@ -61,4 +61,4 @@ case "$reset_type" in
;;
esac
rm
-f
"
$GIT_DIR
/MERGE_HEAD"
"
$GIT_DIR
/rr-cache/MERGE_RR"
rm
-f
"
$GIT_DIR
/MERGE_HEAD"
"
$GIT_DIR
/rr-cache/MERGE_RR"
"
$GIT_DIR
/SQUASH_MSG"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录