-
Forking Go Modules (Or Any Lib) Using Subtree
The two common patterns to forking a module are (1) forking via a separate repo or (2) vendoring, which forks all deps into the current module (or app). I recommend a third approach to forking using
git subtreeandgo mod edit -replace. It’s very similar to repo forking without the repoLet’s say you’ve made modifications to
github.com/tj/go-spin. Once preserving changes in a repo is needed, usegit subtreeto move the fork into your monorepo, or app repo