🌱 Introduction

If you are a maintainer of Open Source Software, you need to review a lot of PR, this tool is made for you.

With the GitHub feature “repository maintainer permissions on existing pull requests”, now we can edit real PR branch. This tool allow to easily manage PR branches and remotes.

💼 Features:

Checkout a PR (interactively or by its number)

Remove a PR (interactively or by its number)

Remove all “checkouted” PRs for a project.

Push on a PR.

Display all “checkouted” PR (for a project or for all projects)

Clone and fork automatically a repository

Manage all your repositories.

Save your configuration: config/prm (or ~/.prm on Windows)

(or on Windows) Only works with GitHub.

💫 Checkout

Interactive (Remote)

prm # item "checkout" # or # prm checkout # or # prm c

Display the last 50 PRs from GitHub.

Add the user git remote named with the user login.

Checkout the PR branch named like that: <PR_NUMBER>--<BRANCH_NAME>

ex: 1234--myBranch

Interactive (Local)

prm # item "list"

Choose a PR between all “local” PRs.

Checkout the PR branch named like that: <PR_NUMBER>--<BRANCH_NAME>

ex: 1234--myBranch

By Number

prm checkout 1234 # or # prm c 1234

Add the user git remote named with the user login.

Checkout the PR branch named like that: <PR_NUMBER>--<BRANCH_NAME>

ex: 1234--myBranch

💫 Remove

Interactive

Only for the current project.

prm # item "remove" # or # prm rm

Display all “local” PRs.

Remove by one or remove all.

By Number

prm rm 1234 # or # prm remove 1234

Remove the local branch.

Remove the user git remote if necessary.

All

Only for the current project. (not all PR for all your projects)

prm rm --all

Remove all PR related local branches.

Remove all PR related git remote.

It can be also done interactively with the item "remove".

💫 Push

prm push

Push to the PR related branch.

Detect the PR number from the branch name.

Push Force

prm pf

Push force the PR related branch.

Detect the PR number from the branch name.

💫 List

# display local branches related to PR. (current project only) prm list # display local branches related to PR. (all projects) prm list --all # display local branches related to PR. (add projects without 0 related PR) prm list --all --skip-empty = false

Display local branches related to PR for:

current project

all projects

💫 Clone

# clone and fork (if needed) a repository. prm clone git@github.com:user/repo.git # clone (don't create fork on GitHub). prm clone -n git@github.com:user/repo.git # clone and fork (if needed) a repository, # and use the username as root directory. prm clone -r git@github.com:user/repo.git # clone and fork (if needed) a repository. # The fork will be created in an organization. prm clone -o myorg git@github.com:user/repo.git

Clone a repository:

create a fork if needed (can be created to an organization)

add the remotes to the repository

💫 Help

prm -h # or # prm <command> -h

Display PRM help

🔒 Private Repositories

If you need to use prm for a private repository:

Create a Github Token

PRM_GITHUB_TOKEN

export PRM_GITHUB_TOKEN = xxxxxxx

Set the environment variable PRM_GITHUB_TOKEN with this token’s value.

You must replace `xxxxxxx` with your GitHub token.

PRM_GITHUB_TOKEN_FILE

Set the environment variable PRM_GITHUB_TOKEN_FILE with a path to file that contains this token’s value.

export PRM_GITHUB_TOKEN_FILE = /path/to/my/token/secret.txt

Important - `/path/to/my/token/secret.txt` contains only the value of the token.

🔒 GitHub Enterprise

PRM_GITHUB_API_BASE_URL

To use prm with GitHub Enterprise,

export PRM_GITHUB_API_BASE_URL = https://example.com/api/v3

Set the environment variable PRM_GITHUB_API_BASE_URL with the URL of the domain endpoint of your GitHub Enterprise instance.

You must replace `https://example.com/api/v3` with the URL of the domain endpoint.

PRM_GITHUB_API_BASE_URL_FILE

Set the environment variable PRM_GITHUB_API_BASE_URL_FILE with a path to file that contains the URL of the domain endpoint of your GitHub Enterprise instance.

export PRM_GITHUB_API_BASE_URL_FILE = /path/to/my/token/secret.txt

Important - `/path/to/my/token/secret.txt` contains only the URL of the domain endpoint.

📦 How to Install

Linux

From Package Manager

yay -S prm

You can use a package manager:

From Binaries

You can use pre-compiled binaries:

To get the binary just download the latest release for your OS/Arch from the releases page

Unzip the archive.

Add prm in your PATH .

MacOS

From Package Manager

brew tap ldez/tap brew update brew install prm

You can use a package manager:

From Binaries

You can use pre-compiled binaries:

To get the binary just download the latest release for your OS/Arch from the releases page

Unzip the archive.

Add prm in your PATH .

Windows

From Package Manager

scoop install prm

scoop bucket add prm https://github.com/ldez/scoop-bucket.git scoop install prm

You can use a package manager:

From Binaries

You can use pre-compiled binaries:

To get the binary just download the latest release for your OS/Arch from the releases page

Unzip the archive.

Add prm in your PATH .

From Sources