Git 如何从自己的仓库提到另外一个仓库

2020-07-17 17:06:17 +08:00
 monetto

项目名字叫 app 首先我在我自己的仓库中建立了一个新的 Repository git@git.com:my/app.git

然后我们公司的代码是 git@git.com:company/app.git

我在我们公司的代码上新建了一个分支 my_branch

然后使用这个命令 git remote add myrep git@git.com:my/app.git git push -u myrep

然后现在我想要提交我的 PR 我在我公司的 Web 端没看到提 PR 的选项... 只能从 git@git.com:my/app.git 提交到它本身,刷不出来 git@git.com:company/app.git

现在我想问一下怎么才能从我自己的仓库 git@git.com:my/app.git 提交到公司的仓库 git@git.com:company/app.git

是需要 git remote 添加什么吗

1530 次点击
所在节点    git
9 条回复
baiyi
2020-07-17 17:11:03 +08:00
你是想在 compony/app 上提交 my/app 仓库分支的 PR 吗?
chairuosen
2020-07-17 17:13:59 +08:00
pr / mr 不是 git 的功能。时 gitlab/github 软件的功能
chairuosen
2020-07-17 17:15:43 +08:00
@chairuosen #2 两个项目不能是纯 git 提交两个 remote 的关系,得是网站里的 fork 关系,这样在 mr 的页面里就能看到两个项目了
monetto
2020-07-17 17:28:35 +08:00
@chairuosen 因为公司自己的 git web 端没有 fork 功能,我就这样做了一下,但是提交合并请求时候就看不见了...这个现在咋办啊 囧
monetto
2020-07-17 17:29:22 +08:00
@baiyi 对,我自己更新了 git@git.com:my/app.git 的代码,我想提交到 git@git.com:company/app.git ,结果发现 web 端刷不出来 git@git.com:company/app.git 的源。
chairuosen
2020-07-17 17:34:09 +08:00
@monetto #4 。。你问你公司的 IT 呀,什么 web 端?
evilrat
2020-07-17 17:53:16 +08:00
git remote remove $old_origin;
git remote add origin $new_repo_url;
git push origin master --force;
fxjson
2020-07-18 06:40:13 +08:00
可以公司的项目上 git add submodule
baiyi
2020-07-20 08:34:47 +08:00
@monetto #5 pr 不是 git 的功能,如果你公司用的 git web 存储没有提供就不能用。你可以将 my/app 的分支添加 remote,提交到 compony/app,然后在 compony/app 中提交 pr

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/690936

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX