= PRM - Pull Request Manager
image:https://travis-ci.org/ldez/prm.svg?branch=master["Build Status", link="https://travis-ci.org/ldez/prm"]
image:https://goreportcard.com/badge/github.com/ldez/prm["Go Report Card", link="https://goreportcard.com/report/github.com/ldez/prm"]
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 (link:https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/["repository maintainer permissions on existing pull requests"]), now we can edit real PR branch.
This tool allow to easily manage PR branches and remotes.
image:https://asciinema.org/a/176222.png["prm", link="https://asciinema.org/a/176222"]
Feature:
* Checkout a PR by its number.
* Checkout (get) a PR into a list of PRs from GitHub.
* Remove (clean) a PR by its number.
* Remove (clean) all PR for a project.
* Push force a PR (auto).
* Manage all your repositories.
* Save your configuration: `config/prm` (or `~/.prm` on Windows)
* Only works with GitHub.
== How to Install
[source, shell]
----
go get -u github.com/ldez/prm
----
or
* Download `prm` from link:https://github.com/ldez/prm/releases[releases].
* Rename `prm_<OS>-<ARCH>` to `prm`.
* Add `prm` in your `PATH`.
=== Configuration for private repositories
If you need to use `prm` for a private repository:
* Create a https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/[Github Token]
* Set the environment variable `PRM_GITHUB_TOKEN` with this token's value:
+
[source, shell]
----
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.
+
[source, shell]
----
# /path/to/my/token/secret.txt contains only the value of the token.
export PRM_GITHUB_TOKEN=/path/to/my/token/secret.txt
----
== Checkout
=== By Number
[source, shell]
----
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`
=== Interactive (Local)
[source, shell]
----
prm
# item "list"
----
* Choose a PR between all "local" PRs.
* Checkout the PR branch named like that: `<PR_NUMBER>--<BRANCH_NAME>`
+
ex: `1234\--myBranch`
=== Interactive (Remote)
[source, shell]
----
prm
# item "remove"
----
* 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`
== Remove
=== By Number
[source, shell]
----
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)
[source, shell]
----
prm rm --all
----
* Remove all PR related local branches.
* Remove all PR related git remote.
=== Interactive
Only for the current project.
[source, shell]
----
prm rm
# or
prm
# item "remove"
----
* Display all "local" PRs.
* Remove by one or remove all.
== Push
[source, shell]
----
prm push
----
* Push to the PR related branch.
* Detect the PR number from the branch name.
== Push Force
[source, shell]
----
prm pf
----
* Push force the PR related branch.
* Detect the PR number from the branch name.
== List
[source, shell]
----
# 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
[source, shell]
----
prm -h
----