How to update a git repo containing a submodule?

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

  • git svn clone died of signal 11 under cygwin
  • .gitignore Advice for Android Project
  • Git: after performing a commit, show the date of the last push to each remote
  • How do I ignore files in a directory in Git?
  • git synchronization of rebased branches
  • npm install from git url missing some files
  • Differences between these methods of importing existing Git repositories into GitHub?
  • Detect git subfolder in Visual studio code
  • Ruby version change on heroku push
  • Why do I have to “git push --set-upstream origin <branch>”?
  • How do I push new files to GitHub?
  • Do I need to create a changelog file with Git?
  • 2 Solutions collect form web for “How to update a git repo containing a submodule?”

    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.

    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.

    Git Baby is a git and github fan, let's start git clone.