What are the consequences of renaming a fork on GitHub?
Asked Answered
B

2

11

If I fork open-source repository A on GitHub and rename it to B via the Settings tab will I still be able to:

  1. Merge later changes from A into B?
  2. Submit pull requests to A based on changes I have made to B?

Are there any other potential consequences of a rename that I haven't thought of?

Blasien answered 27/12, 2017 at 22:33 Comment(1)
What about existing pull requests? Or forks of your fork created by others?Mylohyoid
M
5

Yes

you can rename your fork without losing the ability to create pull requests and merge changes. Just make sure that you update the URL of the remote in your local clones.

(I forked a project on GitHub, changed its name. Everything still works)

Manaus answered 16/8, 2020 at 11:30 Comment(3)
What about existing pull requests? Or forks of your fork created by others?Mylohyoid
@CraigHicks I'm not sure. I assume existing pull requests should not be affected, because they are linked to the fork, not the name of the fork. Do forks of forks exist? What is your use case? Best option is to try out and report back with an additional answer :)Manaus
I did change the name of my fork after making a pull and the existing pull still showed up on the original projects pull page listing. So it does work.Mylohyoid
O
4

If I fork open-source repository A on GitHub and rename it to B via the Settings tab

Alternative, since Apr. 2022:

You can now name your fork when creating it

Previously, when you forked a repository the fork name would default to the same name as the parent repository.

In some cases, that wasn't ideal because you wanted the fork to have a different name.
Your only option was to rename the fork after it was created. Now you can customize the fork name at the same time you're creating it.

New fork page -- https://static.mcmap.net/file/mcmap/ZG-AbGLDKwfpLC21bC2jaRA/user-images.githubusercontent.com/90000203/162800388-9c07b590-75c4-4a86-8042-6eddea94bb61.png?ssl=1

Read more about working with forks.

So... no need to rename it after fork.
The fork can directly be created with the right target name.

This is reflected in the CLI gh v2.14.0 with gh repo fork --fork-name new-fork".

Oruntha answered 12/4, 2022 at 21:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.