Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add already checked out repo to git as submodule, automatically extract the remote URL from the repo on your local filesystem
#!/usr/bin/env fish
# based on
# tbh git should do better. It can record the particular commit and default remote
# instead of displaying "you accidentally added a git repo, did you mean to add a submodule?"
pushd $argv[1]
set url (git remote get-url (git remote))
git submodule add $url $argv[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment