为一个包含多个模块的项目做贡献。

huangapple go评论161阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2015年9月9日 17:18:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/32475656.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定