【问题标题】:Managing with several remotes使用多个遥控器进行管理
【发布时间】:2020-01-04 15:04:05
【问题描述】:

我刚刚将我的 Django 项目部署到 Heroku,现在我有 git remote -v

heroku  https://git.heroku.com/lyf2000proj.git (fetch)
heroku  https://git.heroku.com/lyf2000proj.git (push)

遥控器。 但我想在 GitHub 上也有项目,但我不知道更好地做到这一点。我的意思是我想对GitHub remote 进行一些更改,并且在测试后还将更改推送到heroku remote。

可能是这样的:

git add .
git commit -m 'commit'

git push github master
OR
git push heroku master

更新

我过去了

git add remote github <url>

嗯,在这之后我也做了

git push -u github master

现在我必须从不同的遥控器获得两个主人。但是当我使用

git branch
* master

只有一个分支。在我提交并使用后使用

git push heroku master

信息列表还在告诉我没有push commit。

【问题讨论】:

    标签: git heroku git-remote


    【解决方案1】:

    但我也想在 GitHub 上做一个项目,但我不知道该怎么做

    在 GitHub 上创建一个新的存储库,并将其投放到远程广告

    # add the second remote
    git remote add github <url>
    
    # Now you can push to any remote you wish
    git push github <branch>
    git push heroku <branch>
    

    git branch

    git branch 只显示本地分支,添加 -a 标志以查看所有分支

    git branch -a

    【讨论】:

    • 好的,我成功了,但还有一些问题在更新中)
    • 执行这个,你会看到你所有的分支:git branch -a
    猜你喜欢
    • 1970-01-01
    • 2016-09-24
    • 2017-08-18
    • 1970-01-01
    • 1970-01-01
    • 2017-11-22
    • 1970-01-01
    • 2016-11-08
    • 2014-10-28
    相关资源
    最近更新 更多