Skip to content

Instantly share code, notes, and snippets.

@devinschumacher
Last active May 9, 2025 19:36
Show Gist options
  • Save devinschumacher/d5fdf0edf2719f000e6f52e807ec928f to your computer and use it in GitHub Desktop.
Save devinschumacher/d5fdf0edf2719f000e6f52e807ec928f to your computer and use it in GitHub Desktop.
Bulk Transfer Github Issues to Another Repository
title tags image
How to Bulk Transfer Github Issues to Another Repository
git
github
programming
how to

How to Bulk Transfer Github Issues to Another Repository

Watch the video

Click to watch the video 👆



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:

$ brew install gh - (Mac)

  1. Make sure you are “authenticated” through Github CLI:

$ gh auth login

  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!

Now you’re ready to bulk transfer your issues!

Bulk Transfer your Issues CLI

  1. Open your terminal & run the command below
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 3
    done

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

  • "repository-a" is the source repository - aka where you want to transfer (move) your issues FROM
  • "repository-b" is the destination repository - aka where you want to transfer (move) your issues TO

In my example, those are:

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

Note: Adjust the sleep <number> number at your own risk. I started without sleep and have seen account rate limits so far with 0 wait, 1 second, and even 2 seconds. It only happened once on 2 seconds but the repo had 80+ issues. So now i've changed it to 3.

Note: It does not COPY them it moves them.

Note: This will bulk transfer both the active and in-active (archived, closed, whatever) issues - which may not be what you want. To transfer only the active ones, see below

Bulk transfer only the ACTIVE issues (skip the closed/archived ones)

gh issue list -s open -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 3
    done
@devinschumacher
Copy link
Author

Subscribe for more awesome stuff! - https://serp.ly/@devin/email

@gxjansen
Copy link

gxjansen commented Aug 8, 2024

This worked nicely for me, thx!

Good to know for others:

  • repository-a is the source, repository-b the destiny
  • this script will not just copy, but also remove the issues from the source.

@devinschumacher
Copy link
Author

This worked nicely for me, thx!

Good to know for others:

  • repository-a is the source, repository-b the destiny
  • this script will not just copy, but also remove the issues from the source.

yes that correct. i should update the verbiage to say "move" instead of copy. Thanks!

@yibudak
Copy link

yibudak commented Dec 22, 2024

Thanks for this one. It worked for me.

@devinschumacher
Copy link
Author

Thanks for this one. It worked for me.

Glad to hear it!

@pierre-eliep-met
Copy link

pierre-eliep-met commented Jan 27, 2025

Hello ! I tried it but I get a : command not found: jq, any idea ?

Solved : https://jqlang.github.io/jq/, just sudo apt install jq

@pierre-eliep-met
Copy link

It works fine, thanks ! And by the way I tested with one label available in both projects and one only source project, the migration works but the label is not created in the destination folder, so one may lose some information in the migration

@devinschumacher
Copy link
Author

It works fine, thanks ! And by the way I tested with one label available in both projects and one only source project, the migration works but the label is not created in the destination folder, so one may lose some information in the migration

are you sure about that? i feel like last time i tried that it created the labels in the new repo.

however, to be safe you can always just create the labels in the new repo that you want carried over and they will be transfered!

@pierre-eliep-met
Copy link

Yes I am sure, I tested with an issue that had a specific label not in repo b and it did not create it. Maybe there has been some changes on github side also

@devinschumacher
Copy link
Author

Yes I am sure, I tested with an issue that had a specific label not in repo b and it did not create it. Maybe there has been some changes on github side also

next time try creating the label in repo-b first, and then i think they will transfer over fine!

@maxheld83
Copy link

if anyone is still struggling with missing labels, try this:

gh label clone owner/source-repo --repo owner/destination-repo

check out the gh cli docs for details https://cli.github.com/manual/gh_label_clone

TL,DR: the repo receiving the ticket transfers must already have all the same labels. This script takes care of that.

@devinschumacher
Copy link
Author

nice find @maxheld83 ! ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment