Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
0ebd5d71
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,发现更多精彩内容 >>
提交
0ebd5d71
编写于
12月 02, 2007
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'js/pull-rebase'
* js/pull-rebase: Teach 'git pull' about --rebase
上级
5b0d6163
cd67e4d4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
1 deletion
+49
-1
Documentation/config.txt
Documentation/config.txt
+7
-0
Documentation/git-pull.txt
Documentation/git-pull.txt
+10
-0
git-pull.sh
git-pull.sh
+10
-1
t/t5520-pull.sh
t/t5520-pull.sh
+22
-0
未找到文件。
Documentation/config.txt
浏览文件 @
0ebd5d71
...
...
@@ -346,6 +346,13 @@ branch.<name>.mergeoptions::
option values containing whitespace characters are currently not
supported.
branch.<name>.rebase::
When true, rebase the branch <name> on top of the fetched branch,
instead of merging the default branch from the default remote.
*NOTE*: this is a possibly dangerous operation; do *not* use
it unless you understand the implications (see gitlink:git-rebase[1]
for details).
clean.requireForce::
A boolean to make git-clean do nothing unless given -f
or -n. Defaults to true.
...
...
Documentation/git-pull.txt
浏览文件 @
0ebd5d71
...
...
@@ -33,6 +33,16 @@ include::urls-remotes.txt[]
include::merge-strategies.txt[]
\--rebase::
Instead of a merge, perform a rebase after fetching.
*NOTE:* This is a potentially _dangerous_ mode of operation.
It rewrites history, which does not bode well when you
published that history already. Do *not* use this option
unless you have read gitlink:git-rebase[1] carefully.
\--no-rebase::
Override earlier \--rebase.
DEFAULT BEHAVIOUR
-----------------
...
...
git-pull.sh
浏览文件 @
0ebd5d71
...
...
@@ -17,6 +17,9 @@ test -z "$(git ls-files -u)" ||
die
"You are in the middle of a conflicted merge."
strategy_args
=
no_summary
=
no_commit
=
squash
=
no_ff
=
curr_branch
=
$(
git symbolic-ref
-q
HEAD
)
curr_branch_short
=
$(
echo
"
$curr_branch
"
|
sed
"s|refs/heads/||"
)
rebase
=
$(
git config
--bool
branch.
$curr_branch_short
.rebase
)
while
:
do
case
"
$1
"
in
...
...
@@ -52,6 +55,12 @@ do
esac
strategy_args
=
"
${
strategy_args
}
-s
$strategy
"
;;
-r
|
--r
|
--re
|
--reb
|
--reba
|
--rebas
|
--rebase
)
rebase
=
true
;;
--no-r
|
--no-re
|
--no-reb
|
--no-reba
|
--no-rebas
|
--no-rebase
)
rebase
=
false
;;
-h
|
--h
|
--he
|
--hel
|
--help
)
usage
;;
...
...
@@ -95,7 +104,6 @@ merge_head=$(sed -e '/ not-for-merge /d' \
case
"
$merge_head
"
in
''
)
curr_branch
=
$(
git symbolic-ref
-q
HEAD
)
case
$?
in
0
)
;;
1
)
echo
>
&2
"You are not currently on a branch; you must explicitly"
...
...
@@ -142,5 +150,6 @@ then
fi
merge_name
=
$(
git fmt-merge-msg <
"
$GIT_DIR
/FETCH_HEAD"
)
||
exit
test true
=
"
$rebase
"
&&
exec
git-rebase
$merge_head
exec
git-merge
$no_summary
$no_commit
$squash
$no_ff
$strategy_args
\
"
$merge_name
"
HEAD
$merge_head
t/t5520-pull.sh
浏览文件 @
0ebd5d71
...
...
@@ -53,4 +53,26 @@ test_expect_success 'the default remote . should not break explicit pull' '
test `cat file` = modified
'
test_expect_success
'--rebase'
'
git branch to-rebase &&
echo modified again > file &&
git commit -m file file &&
git checkout to-rebase &&
echo new > file2 &&
git add file2 &&
git commit -m "new file" &&
git tag before-rebase &&
git pull --rebase . copy &&
test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
test new = $(git show HEAD:file2)
'
test_expect_success
'branch.to-rebase.rebase'
'
git reset --hard before-rebase &&
git config branch.to-rebase.rebase 1 &&
git pull . copy &&
test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
test new = $(git show HEAD:file2)
'
test_done
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录