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 https://stackoverflow.com/a/52127956/1412255 | |
# 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)) | |
popd | |
git submodule add $url $argv[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment