Created
June 23, 2020 17:13
-
-
Save peey/668a528bffbee75485f72b83d4b4a3ab to your computer and use it in GitHub Desktop.
Add already checked out repo to git as submodule, automatically extract the remote URL from the repo on your local filesystem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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