From 1214ee081b2e257619d82c00fe9c01a9d524c304 Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Fri, 4 Sep 2020 15:17:27 +0300 Subject: [PATCH] Add "open" command, rename `push -r` to `push -o` - open command: This is an alias for `git pr -o`, but provides a more logical entry point to recommend to people when they are starting. Open always pushes at the same time. - This concept may still be developed, this is only the initial change. - Remove documentation of the `gh` subcommand, it is almost never used directly. - Part of #47. --- README.md | 23 ++++++++++------------- git-pr | 35 +++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 07d6452..4eeaed7 100644 --- a/README.md +++ b/README.md @@ -104,32 +104,29 @@ Only a brief description is shown here. `fetch` before to make sure you are up to date. With one argument, create a branch of this name, otherwise create a detached head. -* `git pr push [-d] [-r]`: Push a PR. With no arguments, send to inferred +* `git pr push [-d] [-o] [[remote] branchname]`: Push a PR. With no + arguments, send to inferred origin automatically with a name the same as the current branch. With one argument, send to a branch of that name. With two arguments, the first is the remote name to use, and the second is - the branch name to push to. + the branch name to push to. `-f` will force push. - Github: The `-r` option will create a pull - request at the same time (recursive invocation of `git pr gh`). The - `-d` and `-n` options are passed to `git pr gh`. + Github: The `-o` option will create a pull + request at the same time. `-n` will skip the "edit pull request + message" step and instead use the message from the (first) commit. + `-d` will open as a draft pull request. Gitlab: The `-r` option will create a merge request with git>=2.10 and Gitlab>=11.10. This is only opened on invocations that actually push something, since this uses [git push options](https://docs.gitlab.com/ce/user/project/push_options.html). +* `git pr open`: Push and open a pull request. This is completely + equivalent to `git pr push -o`, see above for documentation. + * `git pr di`: Diff between current working dir and merge-base of inferred_upstream. -* `git pr gh [-d]`: Create a Github pull request from the command line, - using the same type of logic as `git push` uses. In general, it - does the right thing if you have just pushed a named branch. If you - have pushed a detached head, you must give the branch name when - using this command. (Gitlab pull requests are done within `git pr - push`). `-d` creates a draft pull request. `-n` doesn't prompt to - edit the PR first (`hub pull-request --no-edit`). - * `git pr rm $branch_name ...`: Remove named branches, both locally and on inferred_origin. diff --git a/git-pr b/git-pr index a74607c..e25b69f 100755 --- a/git-pr +++ b/git-pr @@ -41,7 +41,7 @@ print_help () { git-pr: git pull request helper. Subcommands: - Usual work: branch, push, di, gh + Usual work: branch, push, di, open Cleaning up: merged, rm, prune Fetching PR branches: fetch, fetchall, unfetchall Meta: info, set-head @@ -121,9 +121,9 @@ EOF push) if test -n "$HELP" ; then cat <