desktop: unable to commit submodules changes from superproject

Description

Cannot commit & push submodule changes. I can only commit after I commit submodule separately before committing on superproject. Otherwise, an error below is thrown.

Version

GitHub Desktop version: 0.5.8 OS version: Windows 10 (1703) x64

Steps to Reproduce

  1. Change something in your submodule and open GitHub Desktop
  2. You will see the change as {SHA1}-dirty. image
  3. Click on Commit image

Expected behavior: Should commit my changes as usual with submodule.

Actual behavior: Commit failed - exit code 1 received given.

Reproduces how often: Always

Logs

No informative logs. (No logs for this case)

Additional Information

If I commit changes in submodule before committing on superproject then GitHub Desktop is able to push and/or commit changes. While submodule is already synced, it no longer dirty. At this point I can commit to superproject.

So, If I manually commit & push on submodule:

image

Now I can commit this together with superproject.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 20
  • Comments: 20 (1 by maintainers)

Most upvoted comments

After som investigation, in my case it is not a problem. It is the way git works. You should have your module AND your submodule define in github desktop. And you should : 1 - Commit your change in your submodule 2 - Commit the change in the link to the submodule from your top projetct. It is the way it works with git, so the same with github. The definition of the submodule in github is NOT done automatically, you have to define the repo of your sub module in addition with your top project.

Per jjehl’s comment, by adding the submodule as a GitHub Desktop repository (Ctrl+O, navigate to submodule directory, “Add repository”), the changes can be committed (and pushed) there. I already had followed some of the suggestions here such as doing git checkout master (working directory as submodule directory), and git config push.recurseSubmodules on-demand, which may or may not be necessary for you. You can access the git bash terminal to enter these commands via Ctrl+(backquote character) Ctrl+`

+1 for this - please address it soon! 🥳

Have you really add your submodule in your module in github desktop ? You should replace the file with the files of your submodule, if not, github desktop can not know where is your submodule. The dirt-commit is totally a normal behaviour with submodule, meaning your submodule is not commit so you can not commit the module… I work every days with submodule and github desktop I assure you it works !!