如何更新包含子模块的 git 存储库?
一段时间后,我想更新我的 git 存储库,然后出了问题。 摆脱这种情况的正确方法是什么?
mblsha@siruba:~/src/psi/ $ git status
iris: needs merge
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: src/common.cpp
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# unmerged: iris
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# gupdate.sh
mblsha@siruba:~/src/psi/ $ git submodule status
+cf237ef8f3d9dc058dbde47e6973e6388608ce60 iris (heads/master)
+cf237ef8f3d9dc058dbde47e6973e6388608ce60 iris (heads/master)
+cf237ef8f3d9dc058dbde47e6973e6388608ce60 iris (heads/master)
mblsha@siruba:~/src/psi/ $ cd iris
mblsha@siruba:~/src/psi/iris/ $ cat .git/HEAD
cf237ef8f3d9dc058dbde47e6973e6388608ce60
After some time I wanted to update my git repo, and then something went wrong. What is the proper way out of this situation?
mblsha@siruba:~/src/psi/ $ git status
iris: needs merge
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: src/common.cpp
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
#
# unmerged: iris
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# gupdate.sh
mblsha@siruba:~/src/psi/ $ git submodule status
+cf237ef8f3d9dc058dbde47e6973e6388608ce60 iris (heads/master)
+cf237ef8f3d9dc058dbde47e6973e6388608ce60 iris (heads/master)
+cf237ef8f3d9dc058dbde47e6973e6388608ce60 iris (heads/master)
mblsha@siruba:~/src/psi/ $ cd iris
mblsha@siruba:~/src/psi/iris/ $ cat .git/HEAD
cf237ef8f3d9dc058dbde47e6973e6388608ce60
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当涉及到 git 子模块时,几乎您遇到的任何问题都可以通过以下方式解决:
显然,如果您对子模块进行了本地更改,这将永久删除它们,因此,如果您有本地更改,请确保首先推送它们。
When it comes to git submodules, almost any problem you encounter can be solved by:
Obviously if you have made local changes to your submodule this will DELETE them PERMANENTLY, so if you have local changes make sure you have pushed them first.
我在 stackoverflow 上发布了类似的 问题最终我自己回答了这个问题,但我发现使用 git reset HEAD iris 可以解决我的子模块冲突问题。
I posted a similar question here on stackoverflow and ended up answering it myself, but I found that using
git reset HEAD iris
worked for my issue with submodule conflicts.