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)
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 

  • How can I preserve line endings when I check out a single file to a different location with git?
  • How to remove a section of a project's commit history in Git?
  • Which user executes the post-receive hook on a Windows machine?
  • How can I share local commits to my TFS 2017 server from a submodule hosted in github?
  • Pycharm, django south migration files and git integration
  • how to change gitconfig location?
  • Unknown option git config --local reported by Jenkins
  • Git Svn dcommit error - restart the commit
  • How do I find all git revisions of a file which contains foo?
  • How to hide private information in an open source project?
  • How to find previous merge commit
  • Failed to connect to github 443
  • 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.