31

I've cloned a project, and pushed a branch with just a renamed readme file to README. I am trying to create a pull-request on the command line, just to try PR from here instead of a website.

$ git request-pull origin/master origin readme:readme
The following changes since commit 51320a3a42f82ba83cd7919d24ac4aa5c4c99ac6:

  first commit message

are available in the git repository at:

  git@github.com:example/com:example.git readme

for you to fetch changes up to 891c05c5236341bcbe33ceddc415ae921ee42e44:

  second commit message

----------------------------------------------------------------
Simone Gentili (1):
      Fix

 readme.md => README.md | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename readme.md => README.md (100%)

github shows no pull request and I don't see errors.

  • is possibile to create a pull request directly from bash?
  • is PR correct and can I view pull request list?
Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190
sensorario
  • 20,262
  • 30
  • 97
  • 159

3 Answers3

48

Even though they are called exactly the same thing, a GitHub pull request and a 'git request-pull' are completely different.

The git request-pull is for generating a summary of pending changes to be sent to a mailing list. It has no integration by default with GitHub.

The GitHub Pull Requests is a fully featured function of GitHub only. It allows for merging and integration of code from a different branch/fork. You can resolve merge conflicts, do code reviews, or add additional comments to a GitHub pull request.

Unfortunately the git command is named similarly to GitHub functionality which makes it sound like they should be doing the same thing.

William Ross
  • 3,568
  • 7
  • 42
  • 73
  • 3
    yes this. comparing oranges to apples. i like @ChrisMaes below for the best option for doing Github PRs in the terminal. – Randy L Oct 01 '17 at 21:49
22

Github has developed hub:

hub is a command-line wrapper for git that makes you better at GitHub.

which allows you to do that using

hub pull-request

Note that, unlike git request pull, this is the same as a pull request done via the web interface.

Documentation for the hub pull-request command: https://hub.github.com/hub-pull-request.1.html

Andrew
  • 3,825
  • 4
  • 30
  • 44
Chris Maes
  • 35,025
  • 12
  • 111
  • 136
  • 1
    but `pull-request` is not part of `git`. So you can not run in it terminal. OP asks to run it on terminal, isn't it ? – Abhisek Mar 27 '17 at 17:04
  • 4
    @Abhisek, consider taking a look at the `hub` command first, and you will see that it lets you do exactly what is described in this answer. – larsks Aug 11 '17 at 13:39
12

With Github's new official CLI (command line interface):

gh pr create --base master --title "My first cli PR" --body "What did I do?"

See additional details and options and installation instructions.

Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190