git rebase vs git rebase< upstream> [英] git rebase vs git rebase <upstream>

查看:160
本文介绍了git rebase vs git rebase< upstream>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  git checkout -b parent --track $ b为了重现这种情况,您可以执行以下操作。 $ b touch check.yml 
cat> check.yml<<< EOL
1
2
3
EOL
git add --all
git commit -m父分支
git checkout -b child --track
vim check.yml#更改1至11
git add --all
git commit -m child
git checkout parent
vim check.yml#change 3 to 31
git add --all
git commit --amend

现在如果我运行 git rebase parent child-1 ,你会得到合并冲突,但是如果你 git checkout孩子1&& git rebase 你不会发生冲突。



以下是运行这两者的git命令的一个跟踪。

  $:〜/ webroot / test-repo $ GIT_TRACE = 1 git rebase parent child-1 
trace:exec:'git-rebase'' parent''child-1'
trace:run_command:'git-rebase''parent''child-1'
trace:built-in:git'rev-parse''--parseopt'' - ''parent''child-1'
trace:built-in:git'rev-parse''--git-dir'
trace:built-in:git'rev-parse' '--is-bare-repository'
trace:built-in:git'rev-parse''--show-toplevel'
trace:built-in:git'config''--bool ''rebase.stat'
trace:内置:git'config''--bool''rebase.autostash'
trace:内置:git'config''--bool'' rebase.autosquash'
trace:built-in:git'rev-parse''--verify''parent ^ 0'
trace:built-in:git'rev-parse''--verify ''parent ^ 0'
trace :内置:git'show-ref''--verify''--quiet'' - ''refs / heads / child-1'
trace:built-in:git'rev-parse' '-q''--verify''refs / heads / child-1'
trace:built-in:git'rev-parse''--verify''HEAD'
trace:built- in:git'update-index''-q''--ignore-submodules''--refresh'
trace:内置:git'diff-files''--quiet''--ignore-子模块
trace:内置:git'diff-index''--cached''--quiet''--ignore子模块'HEAD''''
trace:built-在:git'merge-base''d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f''75d8979d743ba575de680fd04d517aa74e813819'
首先,倒带头重播你的作品......
trace:built-in:git'checkout''-q ''d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f ^ 0'
trace:built-in:git'update-ref''ORIG_HEAD''75d8979d743ba575de680fd04d517aa74e813819'
trace:built-in:git'format-patch' '-k''--stdout''--full-index''--ignore-if-in-upstream''--src-prefix = a /''--dst-prefix = b /'' - no-renames'' - no-cover-letter''d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f..75d8979d743ba575de680fd04d517aa $
4e813819'
trace:exec:'git-am''--rebasing''--resolvemsg =
当你解决这个问题时,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
'
trace:run_command:'git-am''--rebasing''--resolvemsg =
当你解决这个问题时,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
'
trace:built-in:git'rev-parse''--parseopt'' - ''--rebasing''--resolvemsg =
当您解决了这个问题,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
'
trace:内置:git'rev-parse''--git-dir'
trace:内置:git'rev-parse''--show-prefix '
trace:built-in:git'rev-parse''--show-toplevel'
trace:built-in:git'var''GIT_COMMITTER_IDENT'
trace:built-in :git'rev-parse''--verify''-q''HEAD'
trace:built-in:git'config''--bool''--get''am.keepcr'
trace:built-in:git'mailsplit''-d4''-o / home / schuettm / webroot / test-repo / .git / rebase-apply''-b'' - '
trace :内置:git'update-index''-q''--refresh'
trace:内建:git'diff-index''--cached''--name-only''HEAD '' - '
trace:built-in:git'cat-file''-t''5290c010a2c88dc29a019cb8f08ece9162a6482c'
trace:built-in:git'cat-file''commit''5290c010a2c88dc29a019cb8f08ece9162a6482c'
trace:内置:git'config''i18n.commitencoding'
trace:built-in:git's ' - ''--pretty = raw''--encoding = UTF-8''5290c010a2c88dc29a019cb8f08ece9162a6482c'' - '
trace:built-in:git'diff-tree''--root' '--binary''--full-index''5290c010a2c88dc29a019cb8f08ece9162a6482c'
申请:父母
trace:内置:git'apply''--build-fake-ancestor''/ home / schuettm /webroot/test-repo/.git/rebase-apply/patch-merge-tmp-index''/home/schuettm/webroot/test-repo/.git/rebase-apply/patch'
trace:built -in:git'write-tree'
使用索引信息重新构建基本树...
trace:内置:git'diff-index''--cached''--diff- filter = AM''--name-status''HEAD'
trace:built-in:git'apply''--cached'
trace:built-in:git'write-tree'$
跟踪:内置:git'merge-recursive''4b825dc642cb6eb9a060e54bf8d69288fbee4904'' - ''HEAD''bf8853bde213ddd00cb31b3d22906cf746dcc2fd'
自动合并check.yml
CONFLICT(添加/添加):在check.yml中合并冲突
trace:内置:git'rerere'
在更改中合并失败。
补丁失败,为0001父$ b $ trace:built-in:git'config''--bool''advice.amworkdir'
失败补丁的副本位于:
/home/schuettm/webroot/test-repo/.git/rebase-apply/patch

当你解决这个问题时,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
$ b $ trace:built-in:git'rev-parse''--verify''-q''HEAD'

  $:〜/ webroot / test-repo $ GIT_TRACE = 1 git rebase 
trace:exec:'git-rebase'
trace:run_command:'git-rebase'
trace:built-in:git'rev-parse''--parseopt'' - - '
trace:built-in:git'rev-parse''--git-dir'
trace:built-in:git'rev-parse''--is-bare-repository'
trace:内置:git'rev-parse''--show-toplevel'
trace:内置:git'config''--bool''rebase.stat'
trace:内置:git'config''--bool''rebase.autostash'
trace:内置:git'config''--bool''rebase.autosquash'
trace :内置:git'rev-parse''--verify''refs / heads / paren t ^ 0'
trace:built-in:git'rev-parse''--verify''refs / heads / parent ^ 0'
trace:built-in:git'symbolic-ref' '-q''HEAD'
trace:内置:git'rev-parse''--verify''HEAD'
trace:built-in:git'merge-base'' - $'$ b $ trace:built-in:git'rev-parse''--verify''HEAD'
trace:built-in:git' update-index''-q''--ignore-submodules''--refresh'
trace:内置:git'diff-files''--quiet''--ignore子模块'
trace:built-in:git'diff-index''--cached''--quiet''--ignore-submodules''HEAD'' - '
trace:built-in:git'合并基础'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f''75d8979d743ba575de680fd04d517aa74e813819'
首先,倒带头重播你的作品...
trace:内建:git'checkout''-q''d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f ^ 0'
trace:buil t-in:git'update-ref''ORIG_HEAD''75d8979d743ba575de680fd04d517aa74e813819'
trace:built-in:git'format-patch''-k''--stdout''--full-index'' - -ignore-if-in-upstream''--src-prefix = a /''--dst-prefix = b /'' - 无重命名'' - 无覆盖字母''5290c010a2c88dc29a019cb8f08ece9162a6482c..75d8979d743ba575de680fd04d517aa7
4e813819'
trace:exec:'git-am''--rebasing''--resolvemsg =
当你解决了这个问题时,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
'
trace:run_command:'git-am''--rebasing''--resolvemsg =
当你解决这个问题时,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
'
trace:built-in:git'rev-parse''--parseopt'' - ''--rebasing''--resolvemsg =
当您解决了这个问题,运行git rebase --continue。
如果您不想跳过此修补程序,请运行git rebase --skip。
要检出原始分支并停止重新绑定,请运行git rebase --abort。
'
trace:内置:git'rev-parse''--git-dir'
trace:内置:git'rev-parse''--show-prefix '
trace:built-in:git'rev-parse''--show-toplevel'
trace:built-in:git'var''GIT_COMMITTER_IDENT'
trace:built-in :git'rev-parse''--verify''-q''HEAD'
trace:built-in:git'config''--bool''--get''am.keepcr'
trace:built-in:git'mailsplit''-d4''-o / home / schuettm / webroot / test-repo / .git / rebase-apply''-b'' - '
trace :内置:git'update-index''-q''--refresh'
trace:内建:git'diff-index''--cached''--name-only''HEAD '' - '
trace:built-in:git'cat-file''-t''75d8979d743ba575de680fd04d517aa74e813819'
trace:built-in:git'cat-file''commit''75d8979d743ba575de680fd04d517aa74e813819'
trace:内置:git'config''i18n.commitencoding'
trace:built-in:git's ' - ''--pretty = raw''--encoding = UTF-8''75d8979d743ba575de680fd04d517aa74e813819'' - '
trace:built-in:git'diff-tree''--root' '--binary''--full-index''75d8979d743ba575de680fd04d517aa74e813819'
应用:child
trace:built-in:git'write-tree'
trace:built-in:git' rev-parse''--verify''-q''HEAD'
trace:built-in:git'commit-tree''4db00e2710f88742114576a8a7d5ee6875f433c3''-p''d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f'
trace:built- in:git'update-ref''-m''rebase:child''HEAD''f7d50b6e381e0894904bd122d13c5880f8583916'
trace:built-in:git'notes''copy''--for-rewrite = rebase'
trace:内置:git'rev-parse''HEAD'
trace:内建:git'update-ref''-m''完成rebase:refs / heads / child-1到d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f''refs / heads / child-1''f7d50b6e381e0894904bd122d13c5880f85 83916''75d8979d743ba575de680fd04d517aa74e813819'
trace:built-in:git'symbolic-ref''-m''rebase finished:returned to refs / heads / child-1''HEAD''refs / heads / child-1 '
trace:built-in:git'gc''--auto'

如果你盯着它看起来像问题是 git rebase 使用 git'merge-base''--fork-point'' refs / heads / parent''HEAD'来确定合并基础,该合并基础也使用reflog帮助完成,可能是为什么它会提取修改并且不会因冲突而停止。

传递给 git rebase 哪些神奇的参数可以让它具有这种功能? / p>

git rebase的手册页显示分支。< name> .remote 分支。< name> .merge 被使用,但是当我用git config查找它们后, et一个无效的上游错误,所以我猜他们是在内部扩展之前,使用,我不明白。 >你是对的,它是 - 叉点魔术。这实际上是记录


如果<上游>没有指定,上游在分支中配置< name> .remote和branch。< name> .merge选项将被使用(参见 git-config(1))和 - fork-point 选项。如果您目前没有在任何分支上,或者当前分支没有配置的上游分支,那么分叉点会中止。

您可以手动将 - fork-point 添加到您自己的rebase命令中以获得相同效果。



code> - fork-point 并不是世界上最容易描述的,并且rebase文档链接到 git merge-base 文档。它有一个很好的图,但仍然留下很多描述方面的要求。



由于 - 叉点依靠reflogs,只有在您的上游分支reflog保留关键信息时才会起作用。通常情况下,这是90天(可到达提交到期)或30天(无法到达提交到期)。 并不便于描述。 :-)提到它的意图 em>可能有所帮助:它意味着帮助从上游rebase恢复,并且确实如此。


To reproduce the situation I am in you can do the following.

git checkout -b parent --track
touch check.yml
cat > check.yml <<EOL
1
2
3
EOL
git add --all
git commit -m "parent branch"
git checkout -b child --track
vim check.yml # Change 1 to 11
git add --all
git commit -m child
git checkout parent
vim check.yml # change 3 to 31
git add --all
git commit --amend

Now if I you run git rebase parent child-1 you will get a merge conflict but if you git checkout child-1 && git rebase you will not get a conflict.

Here is a trace of the git commands from running both.

$:~/webroot/test-repo$ GIT_TRACE=1 git rebase parent child-1
trace: exec: 'git-rebase' 'parent' 'child-1'
trace: run_command: 'git-rebase' 'parent' 'child-1'
trace: built-in: git 'rev-parse' '--parseopt' '--' 'parent' 'child-1'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'config' '--bool' 'rebase.stat'
trace: built-in: git 'config' '--bool' 'rebase.autostash'
trace: built-in: git 'config' '--bool' 'rebase.autosquash'
trace: built-in: git 'rev-parse' '--verify' 'parent^0'
trace: built-in: git 'rev-parse' '--verify' 'parent^0'
trace: built-in: git 'show-ref' '--verify' '--quiet' '--' 'refs/heads/child-1'
trace: built-in: git 'rev-parse' '-q' '--verify' 'refs/heads/child-1'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
trace: built-in: git 'diff-index' '--cached' '--quiet' '--ignore-submodules' 'HEAD' '--'
trace: built-in: git 'merge-base' 'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f' '75d8979d743ba575de680fd04d517aa74e813819'
First, rewinding head to replay your work on top of it...
trace: built-in: git 'checkout' '-q' 'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f^0'
trace: built-in: git 'update-ref' 'ORIG_HEAD' '75d8979d743ba575de680fd04d517aa74e813819'
trace: built-in: git 'format-patch' '-k' '--stdout' '--full-index' '--ignore-if-in-upstream' '--src-prefix=a/' '--dst-prefix=b/' '--no-renames' '--no-cover-letter' 'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f..75d8979d743ba575de680fd04d517aa$
4e813819'
trace: exec: 'git-am' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: run_command: 'git-am' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: built-in: git 'rev-parse' '--parseopt' '--' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--show-prefix'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'var' 'GIT_COMMITTER_IDENT'
trace: built-in: git 'rev-parse' '--verify' '-q' 'HEAD'
trace: built-in: git 'config' '--bool' '--get' 'am.keepcr'
trace: built-in: git 'mailsplit' '-d4' '-o/home/schuettm/webroot/test-repo/.git/rebase-apply' '-b' '--'
trace: built-in: git 'update-index' '-q' '--refresh'
trace: built-in: git 'diff-index' '--cached' '--name-only' 'HEAD' '--'
trace: built-in: git 'cat-file' '-t' '5290c010a2c88dc29a019cb8f08ece9162a6482c'
trace: built-in: git 'cat-file' 'commit' '5290c010a2c88dc29a019cb8f08ece9162a6482c'
trace: built-in: git 'config' 'i18n.commitencoding'
trace: built-in: git 'show' '-s' '--pretty=raw' '--encoding=UTF-8' '5290c010a2c88dc29a019cb8f08ece9162a6482c' '--'
trace: built-in: git 'diff-tree' '--root' '--binary' '--full-index' '5290c010a2c88dc29a019cb8f08ece9162a6482c'
Applying: parent
trace: built-in: git 'apply' '--build-fake-ancestor' '/home/schuettm/webroot/test-repo/.git/rebase-apply/patch-merge-tmp-index' '/home/schuettm/webroot/test-repo/.git/rebase-apply/patch'
trace: built-in: git 'write-tree'
Using index info to reconstruct a base tree...
trace: built-in: git 'diff-index' '--cached' '--diff-filter=AM' '--name-status' 'HEAD'
trace: built-in: git 'apply' '--cached'
trace: built-in: git 'write-tree'
Falling back to patching base and 3-way merge...
trace: built-in: git 'merge-recursive' '4b825dc642cb6eb9a060e54bf8d69288fbee4904' '--' 'HEAD' 'bf8853bde213ddd00cb31b3d22906cf746dcc2fd'
Auto-merging check.yml
CONFLICT (add/add): Merge conflict in check.yml
trace: built-in: git 'rerere'
Failed to merge in the changes.
Patch failed at 0001 parent
trace: built-in: git 'config' '--bool' 'advice.amworkdir'
The copy of the patch that failed is found in:
   /home/schuettm/webroot/test-repo/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

trace: built-in: git 'rev-parse' '--verify' '-q' 'HEAD'

and

$:~/webroot/test-repo$ GIT_TRACE=1 git rebase                                                                                                                                                                            
trace: exec: 'git-rebase'
trace: run_command: 'git-rebase'
trace: built-in: git 'rev-parse' '--parseopt' '--'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'config' '--bool' 'rebase.stat'
trace: built-in: git 'config' '--bool' 'rebase.autostash'
trace: built-in: git 'config' '--bool' 'rebase.autosquash'
trace: built-in: git 'rev-parse' '--verify' 'refs/heads/parent^0'
trace: built-in: git 'rev-parse' '--verify' 'refs/heads/parent^0'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'merge-base' '--fork-point' 'refs/heads/parent' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
trace: built-in: git 'diff-index' '--cached' '--quiet' '--ignore-submodules' 'HEAD' '--'
trace: built-in: git 'merge-base' 'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f' '75d8979d743ba575de680fd04d517aa74e813819'
First, rewinding head to replay your work on top of it...
trace: built-in: git 'checkout' '-q' 'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f^0'
trace: built-in: git 'update-ref' 'ORIG_HEAD' '75d8979d743ba575de680fd04d517aa74e813819'
trace: built-in: git 'format-patch' '-k' '--stdout' '--full-index' '--ignore-if-in-upstream' '--src-prefix=a/' '--dst-prefix=b/' '--no-renames' '--no-cover-letter' '5290c010a2c88dc29a019cb8f08ece9162a6482c..75d8979d743ba575de680fd04d517aa7
4e813819'
trace: exec: 'git-am' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: run_command: 'git-am' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: built-in: git 'rev-parse' '--parseopt' '--' '--rebasing' '--resolvemsg=
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--show-prefix'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'var' 'GIT_COMMITTER_IDENT'
trace: built-in: git 'rev-parse' '--verify' '-q' 'HEAD'
trace: built-in: git 'config' '--bool' '--get' 'am.keepcr'
trace: built-in: git 'mailsplit' '-d4' '-o/home/schuettm/webroot/test-repo/.git/rebase-apply' '-b' '--'
trace: built-in: git 'update-index' '-q' '--refresh'
trace: built-in: git 'diff-index' '--cached' '--name-only' 'HEAD' '--'
trace: built-in: git 'cat-file' '-t' '75d8979d743ba575de680fd04d517aa74e813819'
trace: built-in: git 'cat-file' 'commit' '75d8979d743ba575de680fd04d517aa74e813819'
trace: built-in: git 'config' 'i18n.commitencoding'
trace: built-in: git 'show' '-s' '--pretty=raw' '--encoding=UTF-8' '75d8979d743ba575de680fd04d517aa74e813819' '--'
trace: built-in: git 'diff-tree' '--root' '--binary' '--full-index' '75d8979d743ba575de680fd04d517aa74e813819'
Applying: child
trace: built-in: git 'write-tree'
trace: built-in: git 'rev-parse' '--verify' '-q' 'HEAD'
trace: built-in: git 'commit-tree' '4db00e2710f88742114576a8a7d5ee6875f433c3' '-p' 'd29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f'
trace: built-in: git 'update-ref' '-m' 'rebase: child' 'HEAD' 'f7d50b6e381e0894904bd122d13c5880f8583916'
trace: built-in: git 'notes' 'copy' '--for-rewrite=rebase'
trace: built-in: git 'rev-parse' 'HEAD'
trace: built-in: git 'update-ref' '-m' 'rebase finished: refs/heads/child-1 onto d29fb1b0ab2eefba0f8ef13fd4e37d61acb9ee6f' 'refs/heads/child-1' 'f7d50b6e381e0894904bd122d13c5880f8583916' '75d8979d743ba575de680fd04d517aa74e813819'
trace: built-in: git 'symbolic-ref' '-m' 'rebase finished: returning to refs/heads/child-1' 'HEAD' 'refs/heads/child-1'
trace: built-in: git 'gc' '--auto'

If you stare at it for a while it looks like the issue is that git rebase uses git 'merge-base' '--fork-point' 'refs/heads/parent' 'HEAD' to determine the merge base which from the man page also uses the reflog to help out and is likely why it picks up the amend and doesn't stop with a conflict.

What magical arguments are getting passed to git rebase under the hood that allows it to have this functionality?

The man page for git rebase says that branch.<name>.remote and branch.<name>.merge are used however when i substitute those values in after looking them up with git config I get an invalid upstream error so i'm guessing they are expanded in some way internally before use that i don't understand.

解决方案

You are correct, it is the --fork-point magic. This is actually documented:

If <upstream> is not specified, the upstream configured in branch.<name>.remote and branch.<name>.merge options will be used (see git-config(1) for details) and the --fork-point option is assumed. If you are currently not on any branch or if the current branch does not have a configured upstream, the rebase will abort.

You can manually add --fork-point to your own rebase command to get the same effect.

The behavior of --fork-point is not the easiest in the world to describe and the rebase documentation links to the git merge-base documentation. It has a nice diagram but still leaves much to be desired in terms of description.

Because --fork-point relies on reflogs, it only works as long as your upstream branch reflog retains key information. Typically this is for 90 days (the expiry for reachable commits) or 30 days (the expiry for unreachable commits). This does not make it any easier to describe. :-) Mentioning its intent may help: it's meant to help with recovering from an upstream rebase, and it does do that.

这篇关于git rebase vs git rebase&lt; upstream&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆