- Create a fork of the original repo
- Create a new branch
- Add modifications to the code
- Push branch into forked repo
- Tag this branch with version higher then original repo, e.g. if original repo had v0.7.0 then the tag v0.7.1 should be applied to the forked branch
git tag -a v0.7.1 git push origin v0.7.1
- Change go.mod file of my package to use replace directive and my new tag like in the following go.mod example:
Last active
February 9, 2023 12:46
-
-
Save lmllrjr/a4fa3a9ec77026a9d7cb65b3a81191fb to your computer and use it in GitHub Desktop.
Import a specific branch of a forked repo into Go code
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
module github.com/<username>/<reponame> | |
go 1.19 | |
require ( | |
github.com/<username>/pkg v0.7.0 | |
) | |
// Order will matter here | |
replace github.com/<username>/pkg v0.7.0 => github.com/<username>/pkg v0.7.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment