One of the biggest time savers for me is the ability to open a pull request from the command-line. Without hub
there is an odd workflow where you commit and push from the command-line, then switch to your browser to open a pull request and build releases. Hub allows us to manage the entire process in one place.
To open a PR, use the pull-request
subcommand.
Basic usage
The easiest way to open a pull request is to use the command with no arguments.
$ hub pull-request
This will open your default text editor and give you the opportunity to add a title and description. Keep in mind
Here is where the title goes.
Anything below the title will be used as the description. **Markdown supported!**
# ------------------------ >8 ------------------------
# Do not modify or remove the line above.
# Everything below it will be ignored.
Requesting a pull to Howchoo:master from Howchoo:random-feature-branch
Write a message for this pull request. The first block
of text is the title and the rest is the description.
Upon saving the file, you'll see your confirmation with a link to the pull request.
$ hub pull-request
https://github.com/Howchoo/repo-name/pull/316
Advanced usage
There are a few command-line arguments that allow for more interesting usage.
Pass the message as an argument
Use -m
to specify a message.
$ hub pull-request -m "This is the title"
If you specify multiple messages, they will be concatenated with a newline in between. So the first message will be used as the title, and any further messages will be used as the description.
$ hub pull-request -m "This is the title" -m "**First line of the description**"
Pass the message from a file
You can also read the message of a file with the -F
argument.
$ hub pull-request -F message.txt
Similarly you can the file from standard input using -
.
$ cat message.txt | hub pull-request -F -
More details
For more details you can type:
$ hub pull-request --help