php - 如何在 GitHub 上为 Laravel 包使用 PR?

标签 php git github laravel-5

当我想在 GitHub 上为 Laravel 包发出 pull 请求时,我现在通过以下方式进行:

  • 创建新的 Laravel 项目
  • 需要并安装软件包
  • 从供应商文件夹中的项目中删除附加文件
  • Fork GitHub 并将文件克隆到项目文件夹
  • 更改打包并测试所有内容。
  • 添加、提交、推送和执行 pull 请求。

  • 我觉得这有点麻烦 - 这实际上是正确的做法吗?

    例如,如果我想为 voyager package 创建一个 PR我不得不
    为步骤 1. & 2 执行以下命令。
    >laravel new create-pr
    >cd create-pr
    >composer require tcg/voyager
    >php artisan voyager:install
    

    然后删除文件夹 tcg/voyager并将 fork 克隆为新文件夹 tcg/voyager .

    如果我跳过 composer require tcg/voyager并直接将fork克隆到tcg/voyager我无法安装该软件包,因为

    enter image description here

    最佳答案

    首先fork官方仓库tcg/voyager进入您的个人存储库 iwasherefirst2/voyager .然后

    1) 创建一个新的 Laravel 项目

    2) 添加仓库 iwasherefirst2/voyager到 composer.json:

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/iwasherefirst2/voyager.git"
        }
    ],
    

    3) 现在安装 tcg/voyager--pref-source这将自动安装iwasherefirst2/voyager进入 vendor/tcg/voyager并设置git连接。
    composer require tcg/voyager --prefer-source
    

    现在您可以更改 vendor/tcg/voyager 中的文件并推送它们(它们将被推送到您的本地存储库 `iwasherefirst2/voyager)。

    备注

    1) 如果您想在应用程序的根目录中放置包文件夹 package/voyager ,你可以像这样创建一个符号链接(symbolic link):
    ln -s vendor/tcg/voyager package
    

    2) 要在供应商中查看修改过的文件,您可以调用 composer status -v
    $ composer status -v
    You have changes in the following dependencies:
    /path/to/app/vendor/symfony/yaml/Symfony/Component/Yaml:
        M Dumper.php
    

    3) 如果你运行 composer update如果它覆盖了您的任何文件,您将收到警告
    $ composer update
    Loading composer repositories with package information
    Updating dependencies
      - Updating symfony/symfony v2.2.0 (v2.2.0- => v2.2.0)
        The package has modified files:
        M Dumper.php
        Discard changes [y,n,v,s,?]?
    

    关于php - 如何在 GitHub 上为 Laravel 包使用 PR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48115694/

    相关文章:

    php - 保护 WYSIWYG 输入免受 PHP 中的 XSS 攻击?

    带重音的 PHP file_exists 返回 false

    git - 检索从未推送过的 git 提交

    git - 使用 GitHub CLI 向上游提升 PR

    windows - Windows 重新安装后 git stash 不工作

    javascript - 使用 AJAX 按自定义分类术语过滤 WordPress 帖子

    php - jQuery 或 PHP 代码告诉访问者 Javascript 是否被禁用

    git - 如何使用 git 既保护我的作品又获取更新?

    git - 如何使用私有(private) git 服务器 (SSH) 安装 bower 包?

    git - git push 是慢了还是出了什么问题?