Git Submodule: Which commit (hash) do I need?

When I roll back my git working directory to a particular commit, the submodule shows as “modified.” The submodule is checked in and has no modified files, but it’s at different commit than it needs to be. How can I find out the name/hash of the correct commit?

  • Does Git have trouble merging compiled files?
  • How can I calculate the number of lines changed between two commits in git?
  • How to install Git on windows - where to download and which version
  • How to get SHA1 hash from a git repository without cloning?
  • How to get all branches with someone’s commits using git?
  • gitolite + cgit: No repositories found
  • Git push --force from IntelliJ IDEA
  • Git merge/compare tool setup
  • Git Bash won't let me type anything, just shows blanking cursor
  • Calling git from R
  • Is .DS_Store file important?
  • Where are logs of git-daemon saved? (Git on windows using Cygwin)
  • One Solution collect form web for “Git Submodule: Which commit (hash) do I need?”

    If what you’re looking to do is get your submodules to also rollback to their appropriate commits, then try:

    git submodule update --recursive

    This will update all of your submodules to the commit they should be sitting at (referencing the meta data your parent repo has stored with each commit about what commits its submodules should be at).

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