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

Scripts to facilitate working with git submodules #140

Open
gilles-peskine-arm opened this issue Mar 21, 2024 · 1 comment
Open

Scripts to facilitate working with git submodules #140

gilles-peskine-arm opened this issue Mar 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@gilles-peskine-arm
Copy link
Contributor

Working with Git submodules can be awkward: they aren't always supported separately. We should share scripts to facilitate that.

@gilles-peskine-arm gilles-peskine-arm added the enhancement New feature or request label Mar 21, 2024
@gilles-peskine-arm
Copy link
Contributor Author

For me, on a day-to-day basis, the main problem is that worktrees and submodules aren't really supported together out of the box. I've started to build some tooling around that. It isn't yet mature enough to share in tools/bin, but I'm putting it out there so people can try it out.

Please note that you use these scripts at your own risk. They have worked once on my machine (Ubuntu 22.04). They will probably throw strange errors and leave your working directory in a weird state if you try to use them under unexpected conditions. They probably won't directly erase all your files, but they might cause you to accidentally erase all your files when you try to clean up.

Assumption: you have a “main” worktree of mbedtls /path/to/main, where the framework submodule is checked out. You like to work in other mbedtls worktrees where the framework submodule is a worktree of /path/to/main/framework.

  1. [For zsh users] From /path/to/main, create a new worktree to work on a branch, with submodules being also worktrees: adw.zsh.txt (source this from ~/.zshrc)

  2. [For Linux/Mac users] From an alternative worktree of mbedtls where the submodule is not yet initialized, set up the submodule as a worktree: git-worktree-submodules (make it executable and put it in $PATH)

  3. [For Linux/Mac users] Once you're done with a worktree, clean it up, including its submodules which are also worktrees: git-worktree-rm-r.txt (make it executable and put it in $PATH)

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

No branches or pull requests

1 participant