tags:

views:

1028

answers:

2

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
+2  A: 

When it comes to git submodules, almost any problem you encounter can be solved by:

1. deleting the submodule (rm -r iris)
2. recreating it again (git submodule update)

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.

Daniel Lucraft
Interestingly enough, I've tried it and didn't really help, it still said that 'iris' is unmerged after I've updated it from scratch. And most amazintly, the problem disappeared after 'git add iris'.
mblsha
A: 

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.

Tyler