Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sensible submodule configuration #33

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IoannisNezis
Copy link
Collaborator

@IoannisNezis IoannisNezis commented Jan 20, 2024

This PR is ment to fix issue: #32
After running something like:
git submodule update --init --recursive
The submodules should conain remote changes and be on branch.

When i googled this issue i found this:
https://stackoverflow.com/questions/18770545/why-is-my-git-submodule-head-detached-from-master
And i also took a closer look at the Docu:
https://git-scm.com/book/en/v2/Git-Tools-Submodules

How i want to fix this:

submodule.<submodule-path>.update sets the update method.
This defaults to checkout.
"the commit recorded in the superproject will be checked out in the submodule on a detached HEAD"
I think the more sensible method is rebase:
"the current branch of the submodule will be rebased onto the commit recorded in the superproject"

submodule.<submoduke-path>.branch sets the remote branch for a submodule.
As far as i can tell this only has an effect during initialization... this is where i start to get confused.

There is a Problem with these settings... I think.
rebase rebases the **current ** branch of the submodule.
If i have a submodule checked out on a feature branch and i run git submodule updatethis would change the content of the feature branch and not the content of main.
This might be confusing and create chaos.

@IoannisNezis IoannisNezis self-assigned this Jan 20, 2024
@pastewka
Copy link
Collaborator

Happy to work with rebases, but this does not make thing easier necessarily. It leads to cleaner repositories though. (We are using a rebase-only policy in another large project. While that works, there it leads to more effort rebasing diverging branches.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants