- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 Markdown 文章的 Git 存储库,人们在其中创建 pull 请求(每个 Markdown 文章一个),最终 merge 到 master
然后,直接在 master
上工作,我将那篇文章移到一个名为 wordpressed 的文件夹中,然后提交并推送到 master
.
我有一个非常古老的 pull 请求,它仍然位于一个名为 home-base
的分支中。 ,由一个文件 dan/homebase.md 组成,我正在考虑通过更多的提交将其编辑成形状,然后 merge 到 master
.
此 home-base
分支太旧了,从它的角度来看,这个 repo 与今天在 master
中的样子完全不同。 .所以我认为反向 merge 可能会更好 master
进入 home-base
只是为了让它更新,并将 merge 基础向上移动很多。
但是当我尝试这样做时,我遇到了一个我无法理解的 merge 冲突。
为了向您展示情况,我将展示什么是ls
每个分支中的文件和文件夹看起来像。我将从 master
开始:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
$ ls -1 -R
README.md
dan
instructions.md
wordpressed
./dan:
./wordpressed:
AppDelegateRefactor.md
BareListContentView.md
CellContentConfiguration.md
ControlTargetActioniOS14.md
GetStartedWithPods.md
MultipleTrailingClosures.md
StatesAndBackgrounds.md
Swift52notes1.md
Swift52notes2.md
Swift52notes3.md
UserInteractiveCells.md
bdd-common-pitfalls.md
bdd.md
brantsMenuBar.md
collectionViewContentConfig.md
collectionViewLists.md
collectionViewLists2.md
collectionViewOutline.md
debuggingLinks.md
diffableDataSources.md
diffableDataSources2.md
forwardCompatibity.md
haptics.md
iOS13deprecations.md
images
inAppPurchases.md
logging.md
miscSwiftTricks1.md
miscSwiftTricks2.md
miscSwiftTricks3.md
miscSwiftTricks4.md
multipleSelection.md
mysteriesOfLayout.md
newInIOS14.md
packages.md
photoPicker.md
protocolParadox.md
splitViewControllers.md
splitViewControllers2.md
swiftTrickTwoClasses.md
targetActionRant.md
typescript-shape-of-things.md
untappableButton.md
what-vs-how.md
xcode12Editing.md
xcode12testing.md
xcodeWhereAmI.md
xcodeWorkInTwoPlaces.md
./wordpressed/images:
argumentsInScheme.png
bigFlags.png
callHierarchy.png
callersMenu.png
chooser.png
config.png
createdTester.png
dataOrUrl.png
ipadportraitoverlay.png
listOfPepBoys.png
listWithSectionHeaders.png
littleFlags.png
looksLikeADuck.png
newTester.png
outlineIndicatorsWrong.png
outlineIndicatorsWrong2.png
perfectAfterHack.png
pickAPeppa.png
rootOnly.png
sandboxAccountOnDevice.png
selfSizingStringDrawer.png
simpleList.png
split1.png
split2.png
splitViewControllerPadLandscape.png
tableViewAsChoice.png
threecolumns.png
twoPossibilities.png
twoscreensphone.png
variableRowHeights.png
workingOutline.png
如您所见,主文件夹本身大部分是空的。所有文章都在 wordpressed 中,以及在 wordpressed/images 中的图像。
home-base
:
$ git switch home-base
Switched to branch 'home-base'
Your branch is up to date with 'origin/home-base'.
$ ls -1 -R
GetStartedWithPods.md
README.md
Swift52notes1.md
Swift52notes2.md
Swift52notes3.md
dan
debuggingLinks.md
images
logging.md
miscSwiftTricks1.md
miscSwiftTricks2.md
miscSwiftTricks3.md
miscSwiftTricks4.md
packages.md
wordpressed
xcode12Editing.md
xcode12testing.md
xcodeWhereAmI.md
xcodeWorkInTwoPlaces.md
./dan:
bdd.md
homebase.md
./images:
chooser.png
config.png
split1.png
split2.png
./wordpressed:
images
./wordpressed/images:
如您所见,这是一种更早的情况。没有任何东西被移到 wordpressed 上。顶层有几篇文章,dan文件夹有两篇文章,包括我在这里感兴趣的一篇,homebase.md。
master
之间的 merge 基础。和
home-base
:
$ git merge-base master home-base
b5d7355fe42eddad96beb200df2cba65381c288a
$ git checkout b5d7355fe
$ ls -1 -R
GetStartedWithPods.md
README.md
Swift52notes1.md
Swift52notes2.md
Swift52notes3.md
dan
debuggingLinks.md
images
logging.md
miscSwiftTricks1.md
miscSwiftTricks2.md
miscSwiftTricks3.md
miscSwiftTricks4.md
packages.md
wordpressed
xcode12Editing.md
xcode12testing.md
xcodeWhereAmI.md
xcodeWorkInTwoPlaces.md
./dan:
bdd.md
./images:
chooser.png
config.png
split1.png
split2.png
./wordpressed:
images
./wordpressed/images:
嗯,它看起来很像
home-base
现在看起来,不是吗?主要区别在于 homebase.md 出现在 dan 文件夹之前。
master
进入
home-base
. merge 双方的贡献是什么?在我看来,Git 应该在
master
中意识到这一点。 wordpressed 中出现了很多新文件,其中一些文件是对以前位于顶级文件的重命名。另外,当然,在
home-base
,一个新文件 homebase.md 出现在 dan 中。
$ git switch home-base
$ git merge master
CONFLICT (file location): dan/homebase.md added in HEAD inside a directory that was renamed in master, suggesting it should perhaps be moved to wordpressed/homebase.md.
Automatic merge failed; fix conflicts and then commit the result.
$ git status
On branch home-base
Your branch is up to date with 'origin/home-base'.
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Changes to be committed:
deleted: dan/homebase.md
new file: instructions.md
new file: wordpressed/AppDelegateRefactor.md
new file: wordpressed/BareListContentView.md
new file: wordpressed/CellContentConfiguration.md
new file: wordpressed/ControlTargetActioniOS14.md
renamed: GetStartedWithPods.md -> wordpressed/GetStartedWithPods.md
new file: wordpressed/MultipleTrailingClosures.md
new file: wordpressed/StatesAndBackgrounds.md
renamed: Swift52notes1.md -> wordpressed/Swift52notes1.md
renamed: Swift52notes2.md -> wordpressed/Swift52notes2.md
renamed: Swift52notes3.md -> wordpressed/Swift52notes3.md
new file: wordpressed/UserInteractiveCells.md
new file: wordpressed/bdd-common-pitfalls.md
renamed: dan/bdd.md -> wordpressed/bdd.md
new file: wordpressed/brantsMenuBar.md
new file: wordpressed/collectionViewContentConfig.md
new file: wordpressed/collectionViewLists.md
new file: wordpressed/collectionViewLists2.md
new file: wordpressed/collectionViewOutline.md
renamed: debuggingLinks.md -> wordpressed/debuggingLinks.md
new file: wordpressed/diffableDataSources.md
new file: wordpressed/diffableDataSources2.md
new file: wordpressed/forwardCompatibity.md
new file: wordpressed/haptics.md
new file: wordpressed/iOS13deprecations.md
new file: wordpressed/images/argumentsInScheme.png
new file: wordpressed/images/bigFlags.png
new file: wordpressed/images/callHierarchy.png
new file: wordpressed/images/callersMenu.png
renamed: images/chooser.png -> wordpressed/images/chooser.png
renamed: images/config.png -> wordpressed/images/config.png
new file: wordpressed/images/createdTester.png
new file: wordpressed/images/dataOrUrl.png
new file: wordpressed/images/ipadportraitoverlay.png
new file: wordpressed/images/listOfPepBoys.png
new file: wordpressed/images/listWithSectionHeaders.png
new file: wordpressed/images/littleFlags.png
new file: wordpressed/images/looksLikeADuck.png
new file: wordpressed/images/newTester.png
new file: wordpressed/images/outlineIndicatorsWrong.png
new file: wordpressed/images/outlineIndicatorsWrong2.png
new file: wordpressed/images/perfectAfterHack.png
new file: wordpressed/images/pickAPeppa.png
new file: wordpressed/images/rootOnly.png
new file: wordpressed/images/sandboxAccountOnDevice.png
new file: wordpressed/images/selfSizingStringDrawer.png
new file: wordpressed/images/simpleList.png
renamed: images/split1.png -> wordpressed/images/split1.png
renamed: images/split2.png -> wordpressed/images/split2.png
new file: wordpressed/images/splitViewControllerPadLandscape.png
new file: wordpressed/images/tableViewAsChoice.png
new file: wordpressed/images/threecolumns.png
new file: wordpressed/images/twoPossibilities.png
new file: wordpressed/images/twoscreensphone.png
new file: wordpressed/images/variableRowHeights.png
new file: wordpressed/images/workingOutline.png
new file: wordpressed/inAppPurchases.md
renamed: logging.md -> wordpressed/logging.md
renamed: miscSwiftTricks1.md -> wordpressed/miscSwiftTricks1.md
renamed: miscSwiftTricks2.md -> wordpressed/miscSwiftTricks2.md
renamed: miscSwiftTricks3.md -> wordpressed/miscSwiftTricks3.md
renamed: miscSwiftTricks4.md -> wordpressed/miscSwiftTricks4.md
new file: wordpressed/multipleSelection.md
new file: wordpressed/mysteriesOfLayout.md
new file: wordpressed/newInIOS14.md
renamed: packages.md -> wordpressed/packages.md
new file: wordpressed/photoPicker.md
new file: wordpressed/protocolParadox.md
new file: wordpressed/splitViewControllers.md
new file: wordpressed/splitViewControllers2.md
new file: wordpressed/swiftTrickTwoClasses.md
new file: wordpressed/targetActionRant.md
new file: wordpressed/typescript-shape-of-things.md
new file: wordpressed/untappableButton.md
new file: wordpressed/what-vs-how.md
renamed: xcode12Editing.md -> wordpressed/xcode12Editing.md
renamed: xcode12testing.md -> wordpressed/xcode12testing.md
renamed: xcodeWhereAmI.md -> wordpressed/xcodeWhereAmI.md
renamed: xcodeWorkInTwoPlaces.md -> wordpressed/xcodeWorkInTwoPlaces.md
Unmerged paths:
(use "git add <file>..." to mark resolution)
added by us: wordpressed/homebase.md
master
也不是
home-base
有一个文件 wordpressed/homebase.md。那么 Git 是从哪里得知有一个的想法的???它似乎与它认为存在 merge 冲突的相同原因有关:
dan/homebase.md added in HEAD inside a directory that was renamed in master, suggesting it should perhaps be moved to wordpressed/homebase.md.
最佳答案
这个特殊的冲突:
CONFLICT (file location): dan/homebase.md added in HEAD inside a
directory that was renamed in master, suggesting it should perhaps
be moved to wordpressed/homebase.md.
git diff --find-renames <base> <left>
和
git diff --find-renames <base> <right>
,它在左侧检测到一定数量的重命名,在右侧检测到一定数量的重命名(总数为正)。至少其中一些重命名意味着目录名称更改。所以 Git 现在认为 merge 的另一端可能应该应用相同的目录名称更改。
merge.directoryRenames
.其默认值为
conflict
,但您可以将其设置为
true
(意思是总是做出它已经做出的假设,但不要称之为冲突)或
false
(意思是永远不要做出新的假设,因此不要称之为冲突)。
Unmerged paths:
(use "git add <file>..." to mark resolution)
added by us: wordpressed/homebase.md
dan/
的内容。 merge 基础和
HEAD
之间应该改为添加到
wordpressed/
由于它在 merge 底座和
master
的尖端之间看到的变化.
git add
来确认这一点。在那个路径名上。如果没有,Git 希望你把文件移动到你认为它应该去的地方,
git add
结果(并使用
git rm
或
git add
删除,Git 使用的名称)。
关于Git “suggesting [the file] should perhaps be moved”导致的Git文件级 merge 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67067686/
我时不时地输入“git”,然后想到别的东西,然后输入例如“git checkout master”。当然,这给我留下了 $ git git checkout master git: 'git' is
我做到了 git 克隆 git://foo.git 光盘富 ...编辑文件.. 现在我想重新开始。我不在乎我已经做出的任何改变,但我不想再次克隆整个巨型 foo.git,只是丢失我所有的更改。我怎
我在我的电脑上开发代码,我的计算节点很少。 为了让我的程序保持同步,我决定使用 git。以前,我以一种单向模式使用它来“下推”从 PC 到计算节点的更改。但是时不时遇到计算节点特有的小bug,现场修复
虽然它似乎什么也没做,但它没有给出任何警告或错误消息。有什么想法吗? 最佳答案 来自 Git 源的注释: /* * Read a directory tree. We currently ignor
我知道如何为这样的 HTTPS 请求提供用户名和密码: git clone https://username:password@remote 但我想知道如何像这样向 Remote 提供用户名和密码:
Git GUI、Git Bash 和 Git CMD 之间有什么区别?我是初学者,为了进行安装,我发现自己通常同时使用 git bash 和 git CMD 最佳答案 Git CMD 就像使用 git
有人能告诉我git中文件索引被删除是什么意思吗?这些文件在我的 VS Code 中标记为红色,但我仍然可以修改文件并将更改推送到将反射(reflect)这些更改的远程存储库。我认为这一切都是在我使用命
我通过 git 子树将 GLFV 库添加到项目中,但出现此警告“看起来您的 git 安装或您的 git-subtree 安装已损坏”。还描述了几个原因,为什么这可能是: 如 git --exec-pa
我有需要外部 git 项目的 repo,但我不想使用子模块,因为我想在 github 上存档所有文件,所以我认为我只是将具有 git repo 的整个目录添加到 git 但它不t 添加里面的 .git
我有需要外部 git 项目的 repo,但我不想使用子模块,因为我想在 github 上存档所有文件,所以我认为我只是将具有 git repo 的整个目录添加到 git 但它不t 添加里面的 .git
我一直在阅读一篇文章,作者在其中指示:在现有存储库中创建一个新存储库,并想知道这是否是他忽略的错误。稍后我会与他核实。 这些是我要检查的条件: 将现有目录制作成仓库的条件,并且已经 checkin 主
我确实在不同的计算机上处理相同的项目,我想知道是否有一种方法可以跟踪该 .git 文件夹,这样我就不必在所有本地文件中重新配置配置文件。 我将所有工作推送到 bitbucket。 最佳答案 不,没
这个问题在这里已经有了答案: How does git store files? (3 个答案) 关闭 9 年前。 我为我的许多项目创建了一个远程存储库,所以它是我的push 的目的地。与 git
应该如何在 git 中查看文件内容的完整历史记录? 一个文件在 git 中的历史很短,存储库通过 git-svn 同步,但在 svn 中的历史很长。 git 中的历史记录到达文件移动的位置。要查看历史
我是confused here ... 如何对修改后的文件进行git commit,以及如何对新文件进行git commit? 还有,你如何在git中单独提交文件? 最佳答案 git 提交过程分为两个
正在搜索 throw SO 来寻找答案。遇到这个似乎没有给出任何答案的旧线程。重新触发此线程,希望有人知道! 有人能告诉我 git subtree 和 git filter-branch 的区别吗?为
我想知道是否有一种方法可以避免在每个 Git 命令的开头键入单词 git。 如果有一种方法可以在打开命令提示符进入 “Git 模式” 后只使用一次 git 命令就好了。 例如: git> 之后,我们键
当您修改工作目录中的文件时,git 会告诉您使用“git add”暂存。 当您向工作目录添加新文件时,git 会告诉您使用“git add”开始跟踪。 我对这两个概念有点困惑,因为我假设跟踪文件的更改
为什么 git://有效 $ git clone git://github.com/schacon/grit.git Cloning into 'grit'... ... Checking conne
我在以下沙箱中练习 git:https://learngitbranching.js.org/?NODEMO 我在两个单独的 session 中运行了两组命令。第一组命令顺序如下: git clone
我是一名优秀的程序员,十分优秀!