Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
git
提交
41753312
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,发现更多精彩内容 >>
提交
41753312
编写于
1月 14, 2015
作者:
J
Junio C Hamano
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'sp/subtree-doc'
* sp/subtree-doc: subtree: fix AsciiDoc list item continuation
上级
e9f91191
e0a1f093
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
89 addition
and
105 deletion
+89
-105
contrib/subtree/git-subtree.txt
contrib/subtree/git-subtree.txt
+89
-105
未找到文件。
contrib/subtree/git-subtree.txt
浏览文件 @
41753312
...
...
@@ -81,12 +81,11 @@ merge::
changes into the latest <commit>. With '--squash',
creates only one commit that contains all the changes,
rather than merging in the entire history.
If you use '--squash', the merge direction doesn't
always have to be forward; you can use this command to
go back in time from v2.5 to v2.4, for example. If your
merge introduces a conflict, you can resolve it in the
usual ways.
+
If you use '--squash', the merge direction doesn't always have to be
forward; you can use this command to go back in time from v2.5 to v2.4,
for example. If your merge introduces a conflict, you can resolve it in
the usual ways.
pull::
Exactly like 'merge', but parallels 'git pull' in that
...
...
@@ -107,21 +106,19 @@ split::
contents of <prefix> at the root of the project instead
of in a subdirectory. Thus, the newly created history
is suitable for export as a separate git repository.
After splitting successfully, a single commit id is
printed to stdout. This corresponds to the HEAD of the
newly created tree, which you can manipulate however you
want.
Repeated splits of exactly the same history are
guaranteed to be identical (i.e. to produce the same
commit ids). Because of this, if you add new commits
and then re-split, the new commits will be attached as
commits on top of the history you generated last time,
so 'git merge' and friends will work as expected.
Note that if you use '--squash' when you merge, you
should usually not just '--rejoin' when you split.
+
After splitting successfully, a single commit id is printed to stdout.
This corresponds to the HEAD of the newly created tree, which you can
manipulate however you want.
+
Repeated splits of exactly the same history are guaranteed to be
identical (i.e. to produce the same commit ids). Because of this, if
you add new commits and then re-split, the new commits will be attached
as commits on top of the history you generated last time, so 'git merge'
and friends will work as expected.
+
Note that if you use '--squash' when you merge, you should usually not
just '--rejoin' when you split.
OPTIONS
...
...
@@ -151,109 +148,96 @@ OPTIONS FOR add, merge, push, pull
--squash::
This option is only valid for add, merge, push and pull
commands.
Instead of merging the entire history from the subtree
project, produce only a single commit that contains all
the differences you want to merge, and then merge that
new commit into your project.
Using this option helps to reduce log clutter. People
rarely want to see every change that happened between
v1.0 and v1.1 of the library they're using, since none of the
interim versions were ever included in their application.
Using '--squash' also helps avoid problems when the same
subproject is included multiple times in the same
project, or is removed and then re-added. In such a
case, it doesn't make sense to combine the histories
anyway, since it's unclear which part of the history
belongs to which subtree.
Furthermore, with '--squash', you can switch back and
forth between different versions of a subtree, rather
than strictly forward. 'git subtree merge --squash'
always adjusts the subtree to match the exactly
specified commit, even if getting to that commit would
require undoing some changes that were added earlier.
Whether or not you use '--squash', changes made in your
local repository remain intact and can be later split
and send upstream to the subproject.
+
Instead of merging the entire history from the subtree project, produce
only a single commit that contains all the differences you want to
merge, and then merge that new commit into your project.
+
Using this option helps to reduce log clutter. People rarely want to see
every change that happened between v1.0 and v1.1 of the library they're
using, since none of the interim versions were ever included in their
application.
+
Using '--squash' also helps avoid problems when the same subproject is
included multiple times in the same project, or is removed and then
re-added. In such a case, it doesn't make sense to combine the
histories anyway, since it's unclear which part of the history belongs
to which subtree.
+
Furthermore, with '--squash', you can switch back and forth between
different versions of a subtree, rather than strictly forward. 'git
subtree merge --squash' always adjusts the subtree to match the exactly
specified commit, even if getting to that commit would require undoing
some changes that were added earlier.
+
Whether or not you use '--squash', changes made in your local repository
remain intact and can be later split and send upstream to the
subproject.
OPTIONS FOR split
-----------------
--annotate=<annotation>::
This option is only valid for the split command.
When generating synthetic history, add <annotation> as a
prefix to each commit message. Since we're creating new
commits with the same commit message, but possibly
different content, from the original commits, this can help
to differentiate them and avoid confusion.
Whenever you split, you need to use the same
<annotation>, or else you don't have a guarantee that
the new re-created history will be identical to the old
one. That will prevent merging from working correctly.
git subtree tries to make it work anyway, particularly
if you use --rejoin, but it may not always be effective.
+
When generating synthetic history, add <annotation> as a prefix to each
commit message. Since we're creating new commits with the same commit
message, but possibly different content, from the original commits, this
can help to differentiate them and avoid confusion.
+
Whenever you split, you need to use the same <annotation>, or else you
don't have a guarantee that the new re-created history will be identical
to the old one. That will prevent merging from working correctly. git
subtree tries to make it work anyway, particularly if you use --rejoin,
but it may not always be effective.
-b <branch>::
--branch=<branch>::
This option is only valid for the split command.
After generating the synthetic history, create a new
branch called <branch> that contains the new history.
This is suitable for immediate pushing upstream.
<branch> must not already exist.
+
After generating the synthetic history, create a new branch called
<branch> that contains the new history. This is suitable for immediate
pushing upstream. <branch> must not already exist.
--ignore-joins::
This option is only valid for the split command.
If you use '--rejoin', git subtree attempts to optimize
its history reconstruction to generate only the new
commits since the last '--rejoin'. '--ignore-join'
disables this behaviour, forcing it to regenerate the
entire history. In a large project, this can take a
long time.
+
If you use '--rejoin', git subtree attempts to optimize its history
reconstruction to generate only the new commits since the last
'--rejoin'. '--ignore-join' disables this behaviour, forcing it to
regenerate the entire history. In a large project, this can take a long
time.
--onto=<onto>::
This option is only valid for the split command.
If your subtree was originally imported using something
other than git subtree, its history may not match what
git subtree is expecting. In that case, you can specify
the commit id <onto> that corresponds to the first
revision of the subproject's history that was imported
into your project, and git subtree will attempt to build
its history from there.
If you used 'git subtree add', you should never need
this option.
+
If your subtree was originally imported using something other than git
subtree, its history may not match what git subtree is expecting. In
that case, you can specify the commit id <onto> that corresponds to the
first revision of the subproject's history that was imported into your
project, and git subtree will attempt to build its history from there.
+
If you used 'git subtree add', you should never need this option.
--rejoin::
This option is only valid for the split command.
After splitting, merge the newly created synthetic
history back into your main project. That way, future
splits can search only the part of history that has
been added since the most recent --rejoin.
If your split commits end up merged into the upstream
subproject, and then you want to get the latest upstream
version, this will allow git's merge algorithm to more
intelligently avoid conflicts (since it knows these
synthetic commits are already part of the upstream
repository).
Unfortunately, using this option results in 'git log'
showing an extra copy of every new commit that was
created (the original, and the synthetic one).
If you do all your merges with '--squash', don't use
'--rejoin' when you split, because you don't want the
subproject's history to be part of your project anyway.
+
After splitting, merge the newly created synthetic history back into
your main project. That way, future splits can search only the part of
history that has been added since the most recent --rejoin.
+
If your split commits end up merged into the upstream subproject, and
then you want to get the latest upstream version, this will allow git's
merge algorithm to more intelligently avoid conflicts (since it knows
these synthetic commits are already part of the upstream repository).
+
Unfortunately, using this option results in 'git log' showing an extra
copy of every new commit that was created (the original, and the
synthetic one).
+
If you do all your merges with '--squash', don't use '--rejoin' when you
split, because you don't want the subproject's history to be part of
your project anyway.
EXAMPLE 1. Add command
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录