1
0
mirror of synced 2026-01-06 06:02:35 -05:00
Files
docs/content/pull-requests/collaborating-with-pull-requests/working-with-forks/detaching-a-fork.md
2024-03-19 22:34:23 +00:00

2.5 KiB

title, intro, versions, topics, permissions
title intro versions topics permissions
Detaching a fork You can delete a fork and recreate the same repository, without the connection to the original network.
fpt ghes ghec
* * *
Pull requests
People with admin access for a forked repository can delete the forked repository.

About detaching forks

To turn your fork into a standalone repository, you can clone the fork, use the clone to create a new repository, and then delete the fork. This is useful when you want to take the work you are doing in a different direction or maintain distinct versions.

The new repository will no longer automatically sync with changes from the original repository.

{% note %}

Notes:

  • The new repository will not retain any of its issues, pull requests, wikis, stars, watchers, comments, child forks, or other metadata that may currently be associated with your current fork.
  • All commit metadata will be preserved. Commits may become eligible to be counted as contributions, if they meet certain criteria. For more information, see "AUTOTITLE."

{% endnote %}

{% ifversion ghes %}

{% note %}

Note: If you are unable to detach a fork, contact your site administrator.

{% endnote %}

{% endif %}

Detaching a fork

You can delete a fork and recreate the same repository, without the connection to the original network.

{% data reusables.command_line.open_the_multi_os_terminal %}

  1. Create a bare clone of the fork.

    git clone --bare https://{% data variables.command_line.codeblock %}/EXAMPLE-USER/FORK-NAME.git
    
  2. Delete the forked repository. For more information, see "AUTOTITLE."

    {% warning %}

    Warning: Deleting a fork will permanently delete any associated pull requests and configurations. This action cannot be undone.

    {% endwarning %}

  3. Create a new repository with the same name in the same location. For more information, see "AUTOTITLE."

  4. Mirror-push the repository back to the same remote URL.

    cd FORK-NAME.git
    git push --mirror https://github.com/EXAMPLE-USER/FORK-NAME.git
    
  5. Remove temporary local clone you created earlier.

    cd ..
    rm -rf FORK-NAME.git