V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
monetto
V2EX  ›  git

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

  •  
  •   monetto · 2020-07-17 17:06:17 +08:00 · 1518 次点击
    这是一个创建于 1370 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    然后我们公司的代码是 [email protected]:company/app.git

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

    然后使用这个命令 git remote add myrep [email protected]:my/app.git git push -u myrep

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

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

    是需要 git remote 添加什么吗

    9 条回复    2020-07-20 08:34:47 +08:00
    baiyi
        1
    baiyi  
       2020-07-17 17:11:03 +08:00
    你是想在 compony/app 上提交 my/app 仓库分支的 PR 吗?
    chairuosen
        2
    chairuosen  
       2020-07-17 17:13:59 +08:00
    pr / mr 不是 git 的功能。时 gitlab/github 软件的功能
    chairuosen
        3
    chairuosen  
       2020-07-17 17:15:43 +08:00
    @chairuosen #2 两个项目不能是纯 git 提交两个 remote 的关系,得是网站里的 fork 关系,这样在 mr 的页面里就能看到两个项目了
    monetto
        4
    monetto  
    OP
       2020-07-17 17:28:35 +08:00
    @chairuosen 因为公司自己的 git web 端没有 fork 功能,我就这样做了一下,但是提交合并请求时候就看不见了...这个现在咋办啊 囧
    monetto
        5
    monetto  
    OP
       2020-07-17 17:29:22 +08:00
    @baiyi 对,我自己更新了 [email protected]:my/app.git 的代码,我想提交到 [email protected]:company/app.git ,结果发现 web 端刷不出来 [email protected]:company/app.git 的源。
    chairuosen
        6
    chairuosen  
       2020-07-17 17:34:09 +08:00
    @monetto #4 。。你问你公司的 IT 呀,什么 web 端?
    evilrat
        7
    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
        8
    fxjson  
       2020-07-18 06:40:13 +08:00
    可以公司的项目上 git add submodule
    baiyi
        9
    baiyi  
       2020-07-20 08:34:47 +08:00
    @monetto #5 pr 不是 git 的功能,如果你公司用的 git web 存储没有提供就不能用。你可以将 my/app 的分支添加 remote,提交到 compony/app,然后在 compony/app 中提交 pr
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5688 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 03:07 · PVG 11:07 · LAX 20:07 · JFK 23:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.