GCLI-PULLS(1)

NAME
gcli pulls - Manage Pull Requests on Git Forges

SYNOPSIS
gcli pulls [-a] [-A author] [-L label] [-M milestone] [-s] [-n n] [-o owner -r repo] [search-terms...]
gcli pulls -i pr [-o owner -r repo] actions...
gcli pulls create [-o owner -r repo] [-t branch] [-f owner:branch] [-y] [-R reviewer] [-T template] [PR title...]

DESCRIPTION
Use gcli pulls to list, create, edit or delete Pull Requests (PRs) in repositories on various git(1) forges such as GitLab, Gitea or GitHub. Without any action specified, gcli pulls will list open PRs in the given or auto-detected repository.

OPTIONS

-s, --sorted
    Reverse the output such that most recent items appear at the bottom.

-o, --owner owner
    List PRs in the repository of the given owner. This option can only be used in combination with -r.

-r, --repo repo
    List PRs in the given repository. This option can only be used in combination with -o.

-A, --author author
    Filter pull requests by the given author.

    Note that the implementation is somewhat limited on GitHub and Gitea since the respective API does not allow off-loading the filtering to its side. Due to this fact using this option may take an increased amount of time because gcli pulls needs to iterate all the fetched data and filter out the requested information.

-L, --label label
    Filter pull requests by the given label. See the notes about the -A option above - the same reasoning applies to this option.

-M, --milestone milestone
    Filter pull requests by the given milestone. See the notes about the -A option above - the same reasoning applies to this option.

-a  List all PRs, including closed and merged ones. Cannot be combined with actions. This does not affect the -n option. Note that this flag has a different meaning in the create subcommand. See SUBCOMMANDS for more information.

-n, --count n
    Fetch at least n pull requests. Default: 30. If n is set to -1 this will fetch all pull requests. Note that on large repositories fetching all pull requests can take a considerable amount of time and may result in rate limiting by the respective API.

-i, --id PR
    execute the given actions on the specified PR.

SUBCOMMANDS

create
    Create a new PR in the given or auto-detected repository. The editor will come up and ask you to enter the PR message.

    If the pull request submission has failed, gcli will store the entered message in a file called gcli_message. Whenever this file exists in the current working directory, gcli will ask you whether you wish to recall its contents for the pull request message.

    When the title is omitted gcli will interactively prompt the various options listed below, including the title.

    The following flags can be specified:

    -o, --owner owner
        Specify the owner of the repository where the PR is to be created.

    -r, --repo repository
        Specify the name of the repository where the PR is to be created.

    -t, --to branch
        The target (base) branch of the PR. This is the branch the commits are to be merged into. You may omit this flag if you have set pr.base in your .gcli config file.

    -f, --from owner:branch
        The source (head) branch of the PR. This is the branch that contains the commits that are to be merged into the target repository. You may omit this flag and gcli will try to infer this information.

    -y, --yes
        Do not ask for confirmation before creating the PR. Assume yes.

    -a, --automerge
        Enable the automerge feature when creating the PR.

    -R, --reviewer reviewer
        Add the given reviewer as a reviewer for the pull request that is to be created. To add multiple people as reviewers specify this option more than once, one for each reviewer.

    -T, --template template
        Use the provided template as a template for the PR message. The template file is going to be loaded into the editor to let you edit it further.

    PR Title...
        The title of the Pull Request or Merge Request.

ACTIONS
actions... may be one or more of the following:

all Get all the relevant information about a PR. The following actions are implied: status, op, commits and ci.

checkout
    Do a git checkout of the head branch associated with this pull request. This requires that git(1) is available in the PATH and that the current working directory resides within a clone of the target repository.

commits
    Print the list of commits associated with the Pull Requests.

comments
    Print a list of comments under the PR.

status
    Print metadata of the commit such as the ID, head and base branch etc.

op  Print the original post of the Pull Request.

ci  Print a list of checks that ran on the PR (GitLab Pipelines and GitHub CI).

diff
    Print a diff of the changes attached to the PR. This can be piped into patch(1) or git-apply(1).

close
    Close the PR.

reopen
    Reopen a closed PR.

merge [options]
    Merge the PR. The source branch is deleted by default unless you set the “pr.inhibit-delete-source-branch” option to yes in your .gcli file. You may supply the following options:

    --squash, -s
        Squash the commits before merging.

    --inhibit-delete, -D
        Delete the source branch after merging.

milestone milestone-id
    Assign the pull request to the given milestone-id.

milestone -d
    Clear a set milestone on the pull request.

notes
    Alias for the comments action that prints a list of comments associated with the PR.

labels [options]
    The following options can be specified more than once:

    add label
        Add the given label to the pull request.

    remove label
        Remove the given label from the pull request.

title new-title
    Change the title of the pull request to new-title.

review
    Review the pull request. See gcli-pulls-review(1) for more details on this action.

assign user
    Assign the pull request to the given user.

open
    Open the PR in a web browser using xdg-open(1).

reviews
    List reviews of this pull request.

discussions
    Print the review discussions in a threaded form. This is currently only implemented for GitHub.

approve [options]
    Give your approval on the pull request. You may supply the following options:

    --yes, -y
        Do not ask for confirmation.

    --template, -T file
        Use the file as a template for the approval message. When used with --yes this will make the approval non-interactive.

unapprove [options]
    Revoke your approval on the pull request. For allowed options see approve.

EXAMPLES
Print a list of open PRs in the current project:

    $ gcli pulls

Create a new PR and let gcli interactively prompt you for details:

    $ gcli pr create

Create a new PR in the current Project, the head is the currently checked out branch of git. See git-status(1) The base will be what pr.base in .gcli is set to.

    $ gcli pulls create "summary here"

Print both a summary and comments of PR 11 in herrhotzenplotz/gcli:

    $ gcli pulls -o herrhotzenplotz -r gcli -i 11 all comments

Merge PR 42 in the upstream repository:

    $ gcli pulls -i 42 merge

Note that you could also pull the PR head and merge it manually into the base branch. Assuming trunk is the base branch:

    $ git fetch upstream pull/42/head:42-review
    $ git checkout 42-review
    $ <make etc>
    $ git checkout trunk
    $ git merge --no-ff 42-review

List pull requests that have the “bug” label:

    $ gcli pulls -L bug

List pull requests that are associated with the milestone “version420”:

    $ gcli pulls -M version420

Change the title of pull request #42 on GitHub to “This is the new title”:

    $ gcli -t github pulls -i 42 title "This is the new title"

Same command as above, but with abbreviated pulls subcommand:

    $ gcli -t github pu -i 42 title "This is the new title"

SEE ALSO
git(1), git-merge(1), git-branch(1), gcli(1), patch(1)

AUTHORS
Nico Sonack aka. herrhotzenplotz <nsonack@herrhotzenplotz.de> and contributors.

BUGS
Please report bugs via E-Mail to @PACKAGE_BUGREPORT@.

Alternatively you can report them on any of the forges linked at @PACKAGE_URL@. However, the preferred and quickest method is to use the mailing list.