英文:
contribute to a project with multiple packages
问题
我正在尝试为machinery添加一个用于测试目的的虚拟经纪人/后端,machinery是一个使用#golang编写的任务队列库。
在该项目中,所有的导入路径都是绝对路径,
import "github.com/RichardKnop/machinery/v1/..."
然而,为了包含我的更改,我必须:
- 手动修改这些导入路径为我的分支
- (用我的用户名替换"RichardKnop")
- 测试我的更改
- 在提交拉取请求之前将这些导入路径恢复为原始分支的路径
有没有关于如何在不手动修改导入路径的情况下贡献给他人分支的建议?
英文:
I'm trying to add a fake broker/backend for testing purpose to machinery, which is a task queue library in #golang.
All import paths are absolute in that project,
import "github.com/RichardKnop/machinery/v1/..."
However, to include my changes, I have to
- manually modify those import paths to my fork
- (replace "RichardKnop" with my username),
- test my changes, and
- revert those import paths to owner's fork before making a pull
request.
Is there any suggestion on how to contribute others' forks without manually modifying import paths?
答案1
得分: 5
只需将另一个远程仓库添加到原始的git仓库中。类似于:
cd $GOPATH/src/github.com/RichardKnop/machinery
git remote add myfork git@github.com:missionliao/machinery.git
git checkout -b master myfork/master
Go只是在文件夹中查找源代码,所以文件夹和实际的git位置不必匹配。
英文:
Just add another remote to the original git repository. Something like:
cd $GOPATH/src/github.com/RichardKnop/machinery
git remote add myfork git@github.com:missionliao/machinery.git
git checkout -b master myfork/master
Go is just looking for source code in folders so the folder and its actual git location don't have to match.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论