使用fork而不是原始存储库

时间:2014-10-08 19:57:12

标签: php json symfony github composer-php

在很多情况下,我从一些存储库中制作了分叉,以便纠正错误或添加新功能作为贡献。在这种情况下,当我执行PR时,主存储库后面的开发人员有时需要花费数天来进行合并并测试一切都很好,大多数时候我需要在热点或当时我测试这些更改执行。

SpBowerBundle就是这样,它已经做了一个分叉并修复了一些东西。我已经完成了PR,但我不能等待开发人员执行测试并进行合并。唯一的解决方案是将composer.json指向我已完成的分支,但不是如何。

这是forked repository,这是the commit我做的。这里添加的是composer.json内容:

{
    "name": "NewProject",
    "license": "MIT",
    "type": "project",
    "description": "NewProject",
    "autoload": {
        "psr-4": {
            "": "src/"
        }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.5.*",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "~1.2",
        "twig/extensions": "~1.0",
        "symfony/assetic-bundle": "~2.3",
        "symfony/swiftmailer-bundle": "~2.3",
        "symfony/monolog-bundle": "~2.4",
        "sensio/distribution-bundle": "~3.0",
        "sensio/framework-extra-bundle": "3.0.*@dev",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "friendsofsymfony/jsrouting-bundle": "2.0.*@dev",
        "friendsofsymfony/rest-bundle": "1.5.*@dev",
        "jms/serializer-bundle": "0.13.*@dev",
        "jms/di-extra-bundle": "1.4.*@dev",
        "jms/security-extra-bundle": "dev-master",
        "knplabs/knp-paginator-bundle": "2.4.*@dev",
        "knplabs/knp-menu": "2.0.*@dev",
        "knplabs/knp-menu-bundle": "2.0.*@dev",
        "stof/doctrine-extensions-bundle": "1.2.*@dev",
        "nelmio/api-doc-bundle": "2.7.*@dev",
        "genemu/form-bundle": "2.2.*@dev",
        "misd/phone-number-bundle": "~1.0",
        "liip/monitor-bundle": "dev-master",
        "raulfraile/ladybug-bundle": "~1.0",
        "sp/bower-bundle": "0.12.*@dev",
        "h4cc/alice-fixtures-bundle": "dev-bug/30-command-reference"
    },
    "require-dev": {
        "sensio/generator-bundle": "~2.3"
    },
    "scripts": {
        "post-root-package-install": [
            "SymfonyStandard\\Composer::hookRootPackageInstall"
        ],
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Liip\\MonitorBundle\\Composer\\ScriptHandler::checkHealth"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
            "Liip\\MonitorBundle\\Composer\\ScriptHandler::checkHealth"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.5-dev"
        },
        "symfony-assets-install": "symlink"
    }
}

如何将我的作曲家指向分叉存储库?哪种方法可以解决这个问题?

更新

在@Cerad建议之后我对composer.json文件做了这个更改,但仍然没有从fork更新,我做错了什么?

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/Spea/SpBowerBundle.git"
    }
],
"require": {
    ....
    "sp/bower-bundle": "dev-master",
},

1 个答案:

答案 0 :(得分:2)

将您的存储库添加到repositories,如果它具有原始composer.json,则应使用该存储库。

{
    ....
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/paquitodev/SpBowerBundle"
        }
    ],
    ....
}