git - 构建并运行一个 go 项目的分支

标签 git go

此博客文章 link考虑到当您 go get 项目时导入路径出现的复杂情况,提供了以下为 Go lang 项目做贡献的说明。我已经根据以下说明创建了一个 mybranch,但是当我执行 go build 并运行程序时,它正在运行 master 分支,而不是 mybranch。如何构建和运行特定分支?当我执行 go build 并运行程序时,它在 master 分支上运行代码。

1.Fork the project
2.get the original one go get github.com/creack/termios
3.cd $GOPATH/src/github.com/creack/termios
4.Add the new remote: git remote add gcharmes git@github.com:gcharmes/termios.git
5.Fetch everything from github git fetch --all
6.Checkout in a new branch git checkout -b mybranch
7.7Contribute, as we are on the original checkout, all the paths are correct
8.Commit and push git commit -p && git push gcharmes mybranch
9.Go to github and create the pull request.

最佳答案

本文用于从您的分支构建 PR( pull 请求),而不是用于运行 go get <yourfork> (因为该 PR 是在分支上发布的)。

正如文章提到的:

Use your fork only as remote placeholder, do not use it locally.

因此,您将您的 PR 作为专用分支推送到您的 fork ,并从那里创建您的 PR。

但是一个go get <original_repo>在您的 PR 在 master 上被接受并 merge 之前不会起作用.

关于git - 构建并运行一个 go 项目的分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26957834/

相关文章:

concurrency - channel 的读写排除

go - Fyne布局中的填充

go - 导入但未使用错误

go - Dep Ensure 什么都不做只是加载

git - 在没有 SSH 访问的情况下在防火墙后使用 GitHub

image - 在Golang中检查HEIC文件格式

git - (不是实际的)Jenkins 工作区缺少点文件

visual-studio-2010 - Visual Studio 2010 中的源代码管理?

git - 关于切换回空主分支的上游消失消息?

linux - 是否有像 Git 一样的 SVN 交互式提交菜单 --interactive?