douwei8295
douwei8295
2016-02-08 13:49

修改Symfony编写器供应商并使用它们直到它们的PR合并为止

I want to create a PR to a Github repo that is used as a vendor in a Symfony project until the merge is done. Let's suppose that it will be done in the future and not get rejected. The repo is not pulled using git, is installed using composer.

What I did:

  1. forked the original repo
  2. created branch 'keepmessages'
  3. edited composer.json with:
  "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/clytemnestra/JMSTranslationBundle"
        }
    ],
   "require": {    
         ....  
        "jms/translation-bundle": "dev-keepmessages",
         ....
    },
  1. composer update

Now, this replaced the package in the vendor with my own forked project's branch. I want to edit some files, commit them, and when I'm ready to, PR to the original repository.

How can I do that?

I've tried pushing some changes to my own repo first, but I'm getting the following:

Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

This is the repository downloaded with composer, so that might be the problem. If I'd pull it myself it would most likely work, but I want to make this work with composter-downloaded repositories because I want to test them on working projects.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duanlu1922 duanlu1922 5年前

    First, you have to setup the remote of the repository you want push into.
    Actually, you want make changes in your fork only, so go in the root directory of the package (e.g. vendor/package/name/) and run :

    git remote add origin https://github.com/clytemnestra/JMSTranslationBundle
    

    Then, just make changes and push when you are done.

    When you want make your PR, just go in your repository (or in the original) and hit "Create a pull request".
    It will automatically propose you to compare your own branch with one of the original repository.
    Select the good branches and submit the PR.
    Try to be as clear as possible with the reason of your PR, and if there is issues related to, just reference them in the message of your PR.

    See Creating pull requests

    Note : To make a clean pull request, keep your changes in one commit.
    To do this, see git rebase and squashing

    Note 2: Commit only the changes you make on the files corresponding to the bug or feature you are working on. All other files should be intact, even if test suites doesn't pass, you don't have to fix them.

    EDIT

    If you got an error like origin remote already exists , run the following :

    git remote set-url origin https://github.com/clytemnestra/JMSTranslationBundle
    
    点赞 评论 复制链接分享