Can you issue pull requests from the command line on GitHub?

后端 未结 9 2577
花落未央
花落未央 2020-11-28 17:48

It seems like you have to interact with github.com to initiate a pull request. Is this so?

相关标签:
9条回答
  • 2020-11-28 18:24

    I've created a tool recently that does exactly what you want:

    https://github.com/jd/git-pull-request

    It automates everything in a single command, forking the repo, pushing the PR etc. It also supports updating the PR if you need to edit/fix it!

    0 讨论(0)
  • 2020-11-28 18:25

    A man search like...

    man git | grep pull | grep request
    

    gives

    git request-pull <start> <url> [<end>]
    

    But, despite the name, it's not what you want. According to the docs:

    Generate a request asking your upstream project to pull changes into their tree. The request, printed to the standard output, begins with the branch description, summarizes the changes and indicates from where they can be pulled.

    @HolgerJust mentioned the github gem that does what you want:

    sudo gem install gh 
    gh pull-request [user] [branch]
    

    Others have mentioned the official hub package by github:

    sudo apt-get install hub
    

    or

    brew install hub 
    

    then

    hub pull-request [-focp] [-b <BASE>] [-h <HEAD>]
    
    0 讨论(0)
  • 2020-11-28 18:33

    I ended up making my own, I find that it works better the other solutions that were around.

    https://npmjs.org/package/pullr

    0 讨论(0)
  • 2020-11-28 18:35

    UPDATE: The hub command is now an official github project and also supports creating pull requests

    ORIGINAL:

    Seems like a particularly useful thing to add to the hub command: http://github.com/defunkt/hub or the github gem: http://github.com/defunkt/github-gem

    I suggest filing an issue with those projects asking for it. The github guys are pretty responsive.

    0 讨论(0)
  • 2020-11-28 18:39

    I've used this tool before- although it seems like there needs to be an issue open first, it is super useful and really streamlines workflow if you use github issue tracking. git open-pull and then a pull request is submitted from whatever branch you are on or select. https://github.com/jehiah/git-open-pull

    EDIT: Looks like you can create issues on the fly, so this tool is a good solution.

    0 讨论(0)
  • 2020-11-28 18:44

    Git now ships with a subcommand 'git request-pull' [-p] <start> <url> [<end>]

    You can see the docs here

    You may find this useful but it is not exactly the same as GitHub's feature.

    0 讨论(0)
提交回复
热议问题