git submodule "you need to resolve your current index first"但没有 merge 冲突

标签 git

我有一个我无法解决的奇怪问题。 Jenkins 正在从存储库进行构建。
它检查应用程序的当前提交(这是正确的),然后初始化子模块(也是正确的,并找到正确的提交)。
但是当它试图做 git submodule update --init --recursive repo ,它保释:

app/views/license/edit.html: needs merge


问题是没有冲突,并且当前提交源中的文件非常好......
我只是不知道从这里去哪里。
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@bitbucket.org:TEAM/api-backend.git # timeout=10
Fetching upstream changes from git@bitbucket.org:TEAM/api-backend.git
 > git --version # timeout=10
using GIT_SSH to set credentials
 > git fetch --tags --progress git@bitbucket.org:TEAM/api-backend.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/dev^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/refs/heads/dev^{commit} # timeout=10
Checking out Revision 99ab7742966fd82f21044e7bf5f405eaf3bd085b (refs/remotes/origin/dev)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 99ab7742966fd82f21044e7bf5f405eaf3bd085b
Commit message: "Front-end update"
 > git rev-list --no-walk 99ab7742966fd82f21044e7bf5f405eaf3bd085b # timeout=10
 > git remote # timeout=10
 > git submodule init # timeout=10
 > git submodule sync # timeout=10
 > git config --get remote.origin.url # timeout=10
 > git submodule init # timeout=10
 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10
 > git config --get submodule.compose/web.url # timeout=10
 > git config -f .gitmodules --get submodule.compose/web.path # timeout=10
 > git submodule update --init --recursive compose/web
hudson.plugins.git.GitException: Command "git submodule update --init --recursive compose/web" returned status code 1:
stdout: app/views/license/edit.html: needs merge

stderr: error: you need to resolve your current index first
Unable to checkout '71e9f5f5d30ec8b2bcd7d341e4b607ab123a4ece' in submodule path 'compose/web'
我尝试了一个虚拟提交,对有问题的文件进行了一些更改,并 merge 到 dev 到分支,但这并没有解决它......
让我感到困惑的是,为什么在我 merge 时它不告诉我有冲突?
进一步测试
我对父存储库进行了全新克隆并运行了 git submodule --init --recursive compose/web .它克隆并成功检查了正确的分支......
所以我什至无法在本地复制它。
我该如何解决?

最佳答案

我从一条完全不同的路径到达这个位置。我试图摆脱糟糕的 merge 并破坏了本地树。我不知道这是否是由于 git 中的错误造成的。或其他途径,但我跑了git merge --quit后跟 git switch master (当前的工作区是一个独立的头,所以它不需要恢复到理智的状态)。树损坏了,因为它有一个 merge 冲突的文件,但没有进行 merge 。
Krishnamoorthy Acharyadeleted answer包含如何挽救它的基本形式,在此处更新:

git reset
git restore .
git switch master
之后 git reset , merge 冲突的文件更改为已编辑,然后 git restore .放弃了所有未决的更改,所以 git switch很高兴。

关于git submodule "you need to resolve your current index first"但没有 merge 冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51700002/

相关文章:

java - 如何通过插件获取当前分支名称

git - Git 是否可以检索仅存在于特定分支中的标签列表?

linux - 在 windows 上使用 linux 服务器通过 windows 共享的 git compatibilty 设置

git - 我如何使用 git blame 查看之前的提交?

git - "Forking"单个主文件到版本控制下的多个变体

git - 推送在 GitKraken 中失败,错误消息为 "Push Failed cannot read property ' fullName' of undefined”

git:时区和时间戳格式

gitosis 询问密码

所有分支的 Git 克隆

java - 如何将项目从 Github 同步到 Eclipse