Skip to content

Instantly share code, notes, and snippets.

@Jim-Holmstroem
Created January 27, 2015 13:52
Show Gist options
  • Save Jim-Holmstroem/47b22b9bc7712d607360 to your computer and use it in GitHub Desktop.
Save Jim-Holmstroem/47b22b9bc7712d607360 to your computer and use it in GitHub Desktop.
recursively replace submodules with code
git submodule status | cut -d' ' -f3 | xargs -I{} bash -c "git config -f .git/config --remove-section submodule.{}" && find -type f -name .git -o -type f -name .gitmodules | xargs rm && rm -rf .git/modules/* && rm .git/index
@Jim-Holmstroem
Copy link
Author

nothing seems to be broken if you do the above command in another branch and then jump back (please let me know if you find anything)

@Jim-Holmstroem
Copy link
Author

however the code will appear from nowhere and git blame and git log is lost for all but the main repositories files.

@Jim-Holmstroem
Copy link
Author

intended use:
temporarily "flatten" all the code into main repo for a push to a build server (DEIS for example cannot pull from private submodules)

@Jim-Holmstroem
Copy link
Author

@Jim-Holmstroem
Copy link
Author

look at https://gist.github.com/Jim-Holmstroem/fd11844c83d91052840a for a more complete solution for pushing to DEIS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment