Forem Creators and Builders 🌱

Cover image for How to Bulk Transfer Github Issues from Repository A to Repository B
Devin
Devin

Posted on

How to Bulk Transfer Github Issues from Repository A to Repository B

Here’s a simple command you can run in your terminal to transfer all the issues from one Github repository to another!

Pre-requisites:

  1. Make sure you have Github CLI installed:
# MAC
brew install gh
Enter fullscreen mode Exit fullscreen mode
  1. Make sure you are “authenticated” through Github CLI:
# start interactive setup

gh auth login
Enter fullscreen mode Exit fullscreen mode
  1. Make sure that the repository you’re transferring from & to have the same labels, fields, etc.
NOTE: I didn't actually test step #3 above... maybe it's not a problem.

Just test it first if you're worried and LMK in the comments if it matters!
Enter fullscreen mode Exit fullscreen mode

Now you’re ready to run to bulk transfer your issues!

  1. Open your terminal & run the command below

Just make sure to replace the organization/repository name syntax with the ones that you want.

In my example, those are:

devinschumacher/repository-a
devinschumacher/repository-b -R devinschumacher/repository-a

gh issue list -s all -L 500 --json number -R devinschumacher/repository-a | \
    jq -r '.[] | .number' | \
    while read issue; do
        gh issue transfer "$issue" devinschumacher/repository-b -R devinschumacher/repository-a
        sleep 2
    done
Enter fullscreen mode Exit fullscreen mode

That’s it!

Top comments (0)