git重设基址头^^失败

git重设基址头^^失败,git,rebase,Git,Rebase,这让我感到困惑:通常git-rebase-HEAD^^^^只是说明: 当前分支测试是最新的 然而,今天我向一位同事演示了git-rebase-I,我首先演示了git-rebase 63c1e126,其中63c1e126是从提交日志中选择的提交,而由于冲突,rebase失败。这怎么可能 进行重新基化的原因-我是为了解决一个问题,即在som other rebase/force push mess(我猜)之后应用了两次相同的提交,并且在第二次应用的第一次提交上,重新基化发生了冲突(使用不同的提交哈希

这让我感到困惑:通常
git-rebase-HEAD^^^^
只是说明:

当前分支测试是最新的

然而,今天我向一位同事演示了
git-rebase-I
,我首先演示了
git-rebase 63c1e126
,其中63c1e126是从提交日志中选择的提交,而由于冲突,rebase失败。这怎么可能

进行重新基化的原因-我是为了解决一个问题,即在som other rebase/force push mess(我猜)之后应用了两次相同的提交,并且在第二次应用的第一次提交上,重新基化发生了冲突(使用不同的提交哈希和一些空格更改)

git的输出:

$ git rebase 63c1e126
First, rewinding head to replay your work on top of it...
Applying: Cherrypicking python files to commit to master
Applying: (#1379) Included .nc files in ignore-list
Applying: Added monthly index-file and stations rtf to gitignore
Applying: Initial clean-up
Applying: Reformat using Eclipse formatting rules
Applying: (#1386) Remove panelGrid warning on login page
...
Applying: (#1378) Apply replacement column headers on export
Applying: (#1378) Eclipse formatting
Applying: (#1381) facilitating new object_spec
Applying: Initial clean-up
Using index info to reconstruct a base tree...
M   WebApp/WebContent/resources/python/export/py_func/copernicus.py
.git/rebase-apply/patch:33: trailing whitespace.
      #local_folder = filepath_local.rsplit('/',1)[0] 
warning: 1 line adds whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging WebApp/WebContent/resources/python/export/py_func/copernicus.py
CONFLICT (content): Merge conflict in WebApp/WebContent/resources/python/export/py_func/copernicus.py
error: Failed to merge in the changes.
Patch failed at 0022 Initial clean-up
Use 'git am --show-current-patch' to see the failed patch

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

git log
取决于您,并显示线性历史记录。Git历史不是线性的,分支和合并就是这样<代码>git日志--图形显示真实的历史记录。你的历史已经融入其中。这意味着您的提交历史记录如下所示

63c1e126 - B - C - I - G - H - K [github/1381_bak]
            \         /
             D - E - F
63c1e126 - B - D1 - C1 - E1 - I1 - F1 - G1 - H1 - K1 [github/1381_bak]
默认情况下,
git-rebase
将删除合并提交并平展您的历史记录。像这样的

63c1e126 - B - C - I - G - H - K [github/1381_bak]
            \         /
             D - E - F
63c1e126 - B - D1 - C1 - E1 - I1 - F1 - G1 - H1 - K1 [github/1381_bak]
注意分支的提交现在是如何交叉的。这可能会导致冲突,因为E不是写在C上的

如果我们查看rebase排序,我们可以看到在将每月索引文件和站点rtf添加到gitignore之后的交错提交。
初始清理
使用Eclipse格式规则重新格式化
最初都是在
添加的每月索引文件和站点rtf之上编写的
。但rebase将使用Eclipse格式化规则对
进行重新格式化
放在
初始清理
之上。第二次
初始清理时出现类似问题

$ git rebase 63c1e126
First, rewinding head to replay your work on top of it...
Applying: Cherrypicking python files to commit to master
Applying: (#1379) Included .nc files in ignore-list
Applying: Added monthly index-file and stations rtf to gitignore
Applying: Initial clean-up                                        (right)
Applying: Reformat using Eclipse formatting rules                 (left)
Applying: (#1386) Remove panelGrid warning on login page          (left)
...
Applying: (#1378) Apply replacement column headers on export
Applying: (#1378) Eclipse formatting
Applying: (#1381) facilitating new object_spec
Applying: Initial clean-up


请注意,如果使用相当新的
git-rebase-r
-rebase-merges
,git将尝试保留分支并重新创建合并。除非您明确希望平展您的历史记录,否则请使用
-r
git log
显示线性历史记录。Git历史不是线性的,分支和合并就是这样<代码>git日志--图形显示真实的历史记录。你的历史已经融入其中。这意味着您的提交历史记录如下所示

63c1e126 - B - C - I - G - H - K [github/1381_bak]
            \         /
             D - E - F
63c1e126 - B - D1 - C1 - E1 - I1 - F1 - G1 - H1 - K1 [github/1381_bak]
默认情况下,
git-rebase
将删除合并提交并平展您的历史记录。像这样的

63c1e126 - B - C - I - G - H - K [github/1381_bak]
            \         /
             D - E - F
63c1e126 - B - D1 - C1 - E1 - I1 - F1 - G1 - H1 - K1 [github/1381_bak]
注意分支的提交现在是如何交叉的。这可能会导致冲突,因为E不是写在C上的

如果我们查看rebase排序,我们可以看到在将每月索引文件和站点rtf添加到gitignore之后的交错提交。
初始清理
使用Eclipse格式规则重新格式化
最初都是在
添加的每月索引文件和站点rtf之上编写的
。但rebase将使用Eclipse格式化规则对
进行重新格式化
放在
初始清理
之上。第二次
初始清理时出现类似问题

$ git rebase 63c1e126
First, rewinding head to replay your work on top of it...
Applying: Cherrypicking python files to commit to master
Applying: (#1379) Included .nc files in ignore-list
Applying: Added monthly index-file and stations rtf to gitignore
Applying: Initial clean-up                                        (right)
Applying: Reformat using Eclipse formatting rules                 (left)
Applying: (#1386) Remove panelGrid warning on login page          (left)
...
Applying: (#1378) Apply replacement column headers on export
Applying: (#1378) Eclipse formatting
Applying: (#1381) facilitating new object_spec
Applying: Initial clean-up


请注意,如果使用相当新的
git-rebase-r
-rebase-merges
,git将尝试保留分支并重新创建合并。除非您明确地想要平展您的历史记录,否则请使用
-r

您是否希望rebase是一个无冲突的操作?重新定基时的冲突不会系统地发生,这取决于变化的性质,但它们确实可能发生。rebase基本上是一种自动化一系列cherry Pick(复制提交)的方法是的,我想我希望在我自己的BranchAir上对上一次提交进行rebase时,它们是无冲突的。你是对的,我有点错过了你选择的哈希来自同一个分支的历史。你能提供你的git日志和git状态输出吗?看看它,我认为这已经开始有了一些意义:)我再加上它,你认为rebase是一个没有冲突的操作吗?重新定基时的冲突不会系统地发生,这取决于变化的性质,但它们确实可能发生。rebase基本上是一种自动化一系列cherry Pick(复制提交)的方法是的,我想我希望在我自己的BranchAir上对上一次提交进行rebase时,它们是无冲突的。你是对的,我有点错过了你选择的哈希来自同一个分支的历史。你能提供你的git日志和git状态输出吗?看看它,我觉得这开始有点道理了:)我会把它加在这里,很好,谢谢。对于我自己的项目,我通常在合并之前在master上重新设置基础,所以我得到了这个超级平滑的线性历史。重新思考这个策略,rebase-r听起来是一个不错的选择。@jonasfh我也这么做,通过
git pull--rebase
git merge--no ff
合并,形成像您这样整洁的功能气泡。我建议采取这一战略
git-rebase-r
在重写复杂历史记录时非常有用。很好,谢谢。对于我自己的项目,我通常在合并之前在master上重新设置基础,所以我得到了这个超级平滑的线性历史。重新思考这个策略,rebase-r听起来是一个不错的选择。@jonasfh我也这么做,通过
git pull--rebase
git merge--no ff
合并,形成像您这样整洁的功能气泡。我建议采取这一战略
git-rebase-r
在重写复杂历史记录时非常有用。