我有一个分支B,它在另一个repo中签出,然后在那里进行了一些更改,在重新绑定之后,他们被--force(这是对最后一个承诺)。 现在,如果我将更改的分支拉入第一个回购库,我会合并冲突。将rebase结果拉入合并冲突
我运行的命令(与不相关的变化,即简化的实际输出)如下:
# First checkout the original B
$ pwd
/home/user/dir1
$ git checkout B
Switched to branch 'B'
Your branch is up-to-date with 'origin/B'.
# Now clone the same repo into another directory and checkout B there
$ cd .. && git clone git clone ssh://[email protected]/myrepo.git dir2 && cd dir2
$ git checkout B
Switched to branch 'B'
Your branch is up-to-date with 'origin/B'.
# Now edit some file, commit it and "merge" the changes
# to the originally last commit as a fixup
$ nano file.txt
$ git commit -a -m "Fixup to file.txt"
$ git rebase -i HEAD~2
... the last commit is "fixup'ed" to the last commit in the original branch (the commit before "Fixup to the file.txt" commit
# Push the B with rewritten history to the upstream
$ git push --force origin B
# Get back to the original repo and pull the changes
$ cd ../dir1
$ git pull origin B
...
CONFLICT (content): Merge conflict in .../file.txt
...
分支的两个副本之间的唯一区别是在“顶部”提交。 是否有可能告诉git,我想用第一个回购中的最后一个提交替换上游没有的git-pull试图查看相应文件中的更改?
你能改写这个问题,并使用分支,遥控器和重要的提交的名字呢? –