117

It happens every now and then. Some library depends on another and a user opens an issue that belongs to the wrong repo. Can I move the issue to the other repo?

You could argue that the issue could be seen as being both repos' issue because one depends on the other and as long as one doesn't work properly both don't. But I'd rather talk about solutions to the issue in the repo it belongs in.

fent
  • 17,861
  • 15
  • 87
  • 91
  • You no longer have to be admin of the source and destination repositories to move an issue between them. See [my answer below](https://stackoverflow.com/a/56373555/6309). – VonC May 30 '19 at 07:22
  • (2023) Github still unable to transfer issues between different accounts/organizations. – Jan Brezina Jan 25 '23 at 16:47

8 Answers8

62

No, officialy you can't move issues between repositories.

There is a hack though, github-issues-import, kind of a plugin, to import issues from a repository to another.

lazd
  • 4,468
  • 3
  • 23
  • 17
Daniel Ribeiro
  • 10,156
  • 12
  • 47
  • 79
  • 4
    Created another hacked gh-issues-importer version here https://github.com/collective/collective.developermanual/blob/master/gh-issues-import.py – Mikko Ohtamaa Oct 17 '12 at 10:41
  • 2
    `gh-issues-import` seemed broken to me (kept getting a 404). I used Mikko's script and it worked ok. However, it didn't keep closed issues closed or import labels or milestones. Just update username/password and remove reference to `colored`. – Alexandre Mar 11 '13 at 19:15
  • 3
    To make Mikko's script work for closed issues, just add `state=closed` to the url's query parameters in the `get_issues` method. – Calvin Jun 24 '13 at 15:29
  • 1
    Mikko's script works great but contains a bug, it creates issues in inverted order. Just add &sort=created&direction=asc to the url's query parameters in the get_issues method. – Marco Fucci Sep 29 '13 at 18:53
  • 1
    I also created a simple issue importer script to move a single issue from one repo to another. It will ask you for username, password, source- and destination repo on every usage, so you wont have to change the code at all. Labels and milestones are also copied. Maybe it's useful for somebody: https://github.com/jotweh/IssueRelocate – Jan Wy Jan 23 '14 at 14:43
  • I got gh-issues-importer to run, but it seems to have a limit on the number of comments per issue (n=30). Jan Wy's script does not copy comments within an issue. – C. Bergman Sep 03 '14 at 20:14
  • @CaseyBergman Are you sure about that limit? Create a new issue about it and I will take a look. – IQAndreas Sep 04 '14 at 23:34
  • Mikko's link is broken. Here is another script: https://github.com/IQAndreas/github-issues-import – phatmann Nov 19 '14 at 15:13
  • 1
    There is now a "Transfer this issue" button (see accepted answer) but if you're not admin, you need a script such as [@IQAndreas's script](https://github.com/IQAndreas/github-issues-import). Works a treat. – Jérôme Nov 03 '18 at 16:25
  • Mikko's script is still available here: https://github.com/collective/collective.developermanual/blob/91bb9e19d56effa23a1926c9cf3069fcd018fee0/gh-issues-import.py – hoijui Nov 20 '19 at 06:28
56

See the GitHub docs on transferring issues.

Transferring an open issue to another repository

On GitHub, navigate to the main page of the repository.

Under your repository name, click Issues.

In the list of issues, click the issue you'd like to transfer.

In the right sidebar, click Transfer this issue.

Community
  • 1
  • 1
Matthew McCullough
  • 17,160
  • 7
  • 39
  • 38
  • 9
    Would be great to be able to move all issues of one repo to another. – stefanbschneider Jun 23 '19 at 17:43
  • 1
    @CGFoX created a feature request at: https://github.com/isaacs/github/issues/1605 – Ciro Santilli OurBigBook.com Jun 27 '19 at 08:05
  • 2
    It should be noted that you need write permission on both repos otherwise this option isn't available. – Brett Sutton May 26 '20 at 23:11
  • 1
    You can only choose moving an issue to other repositories of your own GitHub account. This is unexpected. I have just built up a couple of issues, and I would have thought this a small thing to do to move all issues, milestones and the project board to another account's GitHub project. But no, you have click each Issue again and again, and you cannot move it to another account. – questionto42 Jun 14 '21 at 14:45
7

I've created a Chrome Extension called Kamino that will clone issues from one repository to another. It will also close the original issue. It will also eventually be available for MS Edge.

https://chrome.google.com/webstore/detail/kamino/ffdebockfdjileaojbbccofhgncmioaf?hl=en-US

John Murphy
  • 905
  • 1
  • 10
  • 26
5

Move Issue If you have the ZenHub integration you will see this button at the very lower-right when viewing an issue. This allows the issue to be copied to another repo in the same organization, or copied and closed.

And yes, "Move Issue" is a misnomer.

There seems to still be no way to move (copy and delete) or to just delete, a mistakenly-submitted issue.

EDIT: Beware, the v1 of this feature has major limitations like leaving behind some(most?) of the issue's metadata, not notifying subscribers, etc.

Spike0xff
  • 1,246
  • 1
  • 15
  • 24
  • Hmm, I don't see this button when going to one of my opened issues. – fent Sep 30 '16 at 20:46
  • 1
    @DeaDEnD Oh hell, my bad. It's a ZenHub feature, not built into GitHub. Well that's not confusing at all, having two organizations independently hacking on the same web UI. – Spike0xff Oct 03 '16 at 15:35
  • 1
    And am I just a silly crank for thinking that in my dialect of English, when you _move_ something, it shows up in a new place and _ceases to be where it was before_? A _two word_ UI, and they couldn't get them both right? – Spike0xff Oct 03 '16 at 15:47
  • I tried it, but could not find my organization repos on the "move to" listing – alanjds Aug 03 '18 at 17:05
4

The visual answer as taken from github docs:

Transferring an open issue to another repository

  1. On GitHub, navigate to the main page of the repository.
  2. Under your repository name, click Issues. Issues tab
  3. In the list of issues, click the issue you'd like to transfer.
  4. In the right sidebar, click Transfer issue. Button to transfer issue
  5. Use the Choose a repository drop-down menu, and select the repository you want to transfer the issue to.

Choose a repository selection

  1. Click Transfer issue.

Transfer issue button

Riyafa Abdul Hameed
  • 7,417
  • 6
  • 40
  • 55
  • Yes, the documentation I mention in my own answer: https://stackoverflow.com/a/56373555/6309 – VonC Aug 01 '19 at 05:01
3

This is now (May 2019) easier.

See "Improvements to issue transfer permissions "

Users with write access to two repositories can now use issue transfer to move issues between them.
Previously, only users with admin permissions on both repositories had the ability to transfer issues.

In addition, we will no longer allow issues to be transferred from private to public repositories.

See more at "Transferring an issue to another repository".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
2

Addition to the answer from @MatthewMcCullough.

If you have many issues to transfer doing every one from a browser can be tedious.

You can then use GitHub CLI like this:

gh issue transfer issue owner/repo

Use the gh issue transfer subcommand. Replace the issue parameter with the number or URL of the issue. Replace the owner/repo parameter with the name of the repository that you want to transfer the issue to, such as octocat/octo-repo.

Note that:

The issue's labels and milestones are not retained. This issue will stay on any user-owned or organization-wide project boards and be removed from any repository project boards.

https://docs.github.com/en/issues/tracking-your-work-with-issues/transferring-an-issue-to-another-repository

https://docs.github.com/en/github-cli/github-cli/about-github-cli

Ogglas
  • 62,132
  • 37
  • 328
  • 418
0

TO transfer in bulk

must download github CLI first - 99 is the total number of issues you want to transfer, had to use this code to remove /r" from issue ID, tr -d '\r' | sed 's/"//g'

 gh issue list -s all -L 99 --json number | jq -r '.[] | .number' | tr -d '\r' | sed 's/"//g'|   xargs -I% gh issue transfer % https://github.com/<ogName>/<repoName>
smakintel.com
  • 416
  • 4
  • 5