Skip to content

ldez/prm

Repository files navigation

PRM - Pull Request Manager

Build Status Go Report Card

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.

prm

💼 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)
  • Manage all your repositories.
  • Save your configuration: config/prm (or ~/.prm on Windows)
  • Only works with GitHub.

📦 How to install: From binaries - From a package manager - From sources

💡 How to use: Checkout - Remove - Push - Push Force - List - Help


How to Install

From 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.

Available for: Linux, MacOS, Windows, FreeBSD, OpenBSD.

From a Package Manager

yay -S prm
brew tap ldez/tap
brew update
brew install prm
scoop install prm
scoop bucket add prm https://github.com/ldez/scoop-bucket.git
scoop install prm

From Sources

go get -u github.com/ldez/prm

Configuration for Private Repositories

If you need to use prm for a private repository:

  • Create a Github Token
  • Set the environment variable PRM_GITHUB_TOKEN with this token's value:
export PRM_GITHUB_TOKEN=xxxxxxx
  • Or set the environment variable PRM_GITHUB_TOKEN_FILE with a path to file that contains this token's value.
# /path/to/my/token/secret.txt contains only the value of the token.
export PRM_GITHUB_TOKEN_FILE=/path/to/my/token/secret.txt

How to Use

Checkout

Interactive (Remote)

prm
# item "checkout"
  • 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 c -n 1234
# or
prm c --number=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 rm

# or
prm
# item "remove"
  • Display all "local" PRs.
  • Remove by one or remove all.

By Number

prm rm -n 1234
# or
prm rm --number=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 for:
    • current project
    • all projects

Help

prm -h