cma*_*han 15 git production heroku staging
我正在尝试在Heroku上创建一个临时分支,但有些东西我不太了解.
假设我已经创建了一个heroku应用程序并将远程设置为指向staging-remote,如果我这样做:
git checkout -b staging staging-remote/master
Run Code Online (Sandbox Code Playgroud)
我得到一个名为'staging'的本地分支,它跟踪staging-remote/master - 或者这就是我的想法....
但:
git remote show staging-remote
Run Code Online (Sandbox Code Playgroud)
给我这个:
remote staging
Fetch URL: git@heroku.com:myappname.git
Push URL: git@heroku.com:myappname.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
staging-remote merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,拉动看起来合理,但默认推动没有.这意味着,如果我这样做:
git push staging-remote
我要将我的本地主分支推送到临时分支.但这不是我想要的......基本上,我想将更新合并到我的临时分支,然后轻松将其推送到heroku,而不必像这样指定分支:
git push staging-remote mybranch:master
Run Code Online (Sandbox Code Playgroud)
以上并不难做到,但我想避免意外地执行上一次推送并推错分支......这对于我想创建的生产分支来说非常重要!
我已经尝试搞乱git配置,但还没弄明白如何做到这一点......
the*_*uth 25
我测试了它,@ juba和@ MatthewFord的版本完美运行!
git config remote.staging.push staging:master
Run Code Online (Sandbox Code Playgroud)
这推动命名我的本地特性分支分期到远程分支主在指定的远程仓库暂存.
@nickgrim将它放在一般形式中,如下所示:
git config remote.[remoteRepositoryName].push [localBranchName]:[remoteBranchName]
Run Code Online (Sandbox Code Playgroud)
更新:
此外,当您git push
使用以下-u
选项时,现代git将方便地为您运行上述配置命令:
git push -u staging staging:master
Run Code Online (Sandbox Code Playgroud)
我有一个名为heroku的分支,这对我有用:
git config remote.heroku.push heroku:master
Run Code Online (Sandbox Code Playgroud)
你面临的问题是heroku忽略除master之外的所有分支.
归档时间: |
|
查看次数: |
12748 次 |
最近记录: |