我有一个奇怪的问题,我无法解决。詹金斯正在从存储库进行构建。
它检查应用程序的当前提交(这是正确的),然后初始化子模块(也是正确的,并找到正确的提交)。
但当它尝试这样做时git submodule update --init --recursive repo,它会失败:
app/views/license/edit.html:需要合并
问题是没有冲突,并且当前提交的源中的文件完全没问题......
我只是不知道从这里该去哪里。
 > 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'
我尝试了一个虚拟提交,对有问题的文件进行了一些更改,并合并到 dev 分支,但这并没有解决问题......
让我困惑的是,为什么当我合并时它不告诉我存在冲突?
我对父存储库进行了全新克隆并运行了git submodule --init --recursive compose/web. 它成功克隆并签出了正确的分支......
所以我什至无法在本地复制它。
我该如何修复它?
我是通过完全不同的路径到达这个位置的。我试图摆脱一次糟糕的合并并破坏了当地的树。我无法判断这是否是由于错误git或其他路径造成的,但我git merge --quit随后运行git switch master(当前工作区是一个分离的头,因此不需要将其放回正常状态)。该树被破坏,因为它有一个合并冲突的文件,但没有正在进行合并。
Krishnamoorthy Acharya的已删除答案包含如何挽救它的基本形式,更新如下:
git reset
git restore .
git switch master
之后git reset,合并冲突的文件更改为已编辑,然后git restore .放弃所有待处理的更改,所以git switch很高兴。