Skip to content

Instantly share code, notes, and snippets.

@theipster
Created February 26, 2023 19:21
Show Gist options
  • Save theipster/6c78430a3fff6f080761d8dc588dea6e to your computer and use it in GitHub Desktop.
Save theipster/6c78430a3fff6f080761d8dc588dea6e to your computer and use it in GitHub Desktop.
Better git subtree
#!/bin/sh
# Example of how to import Flyway migration scripts sourced in a separate repo
git fetch $(cat path/to/repo/url) refs/tags/<tag>:refs/tags/<tag>
git read-tree --prefix=db -u refs/tags/<tag>
git rm -r src/main/resources/db
git mv db/ src/main/resources/
git commit
git tag -d <tag>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment