Sometimes in projects I change the code and commit directly from the submodule. But there is a case where the changes are easy to lose.
- Clone the project with the submodule and open it in Sublime Merge.
- Open a submodule from “submodules” menu.
- Checkout the branch.
change content in the submodule
- Stage, commit, push
If you forget step 3, the last commit will be in HEAD state, with no relation to branch. If I checkout the branch, Sublime Merge will just delete the local commit without any prompts or warnings. It is my wrong steps, because I can, for example, reset (mixed) to the last commit in a branch and re-commit the changes, but it seems too easy to lose commits and changes.
I fell into this trap 2 times already