1---
2stage: Create
3group: Source Code
4info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
5disqus_identifier: 'https://docs.gitlab.com/ee/workflow/forking_workflow.html'
6---
7
8# Project forking workflow **(FREE)**
9
10Whenever possible, it's recommended to work in a common Git repository and use
11[branching strategies](../../../topics/gitlab_flow.md) to manage your work. However,
12if you do not have write access for the repository you want to contribute to, you
13can create a fork.
14
15A fork is a personal copy of the repository and all its branches, which you create
16in a namespace of your choice. This way you can make changes in your own fork and
17submit them through a merge request to the repository you don't have access to.
18
19## Creating a fork
20
21To fork an existing project in GitLab:
22
231. On the project's home page, in the top right, click **{fork}** **Fork**.
24
25   ![Fork button](img/forking_workflow_fork_button_v13_10.png)
26
271. Select the project to fork to:
28
29   - Recommended method. Below **Select a namespace to fork the project**, identify
30     the project you want to fork to, and click **Select**. Only namespaces you have
31     Developer and higher [permissions](../../permissions.md) for are shown.
32
33     ![Choose namespace](img/forking_workflow_choose_namespace_v13_10.png)
34
35   - Experimental method. If your GitLab administrator has
36     [enabled the experimental fork project form](#enable-or-disable-the-fork-project-form), read
37     [Create a fork with the fork project form](#create-a-fork-with-the-fork-project-form).
38     Only namespaces you have at least the Developer
39     [role](../../permissions.md) for are shown.
40
41   NOTE:
42   The project path must be unique in the namespace.
43
44GitLab creates your fork, and redirects you to the project page for your new fork.
45The permissions you have in the namespace are your permissions in the fork.
46
47WARNING:
48When a public project with the repository feature set to **Members Only**
49is forked, the repository is public in the fork. The owner
50of the fork must manually change the visibility. Issue
51[#36662](https://gitlab.com/gitlab-org/gitlab/-/issues/36662) exists for this issue.
52
53## Repository mirroring
54
55You can use [repository mirroring](mirror/index.md) to keep your fork synced with the original repository. You can also use `git remote add upstream` to achieve the same result.
56
57The main difference is that with repository mirroring, your remote fork is automatically kept up-to-date.
58
59Without mirroring, to work locally you must use `git pull` to update your local repository
60with the upstream project, then push the changes back to your fork to update it.
61
62WARNING:
63With mirroring, before approving a merge request, you are asked to sync. Because of this, automating it is recommended.
64
65Read more about [How to keep your fork up to date with its origin](https://about.gitlab.com/blog/2016/12/01/how-to-keep-your-fork-up-to-date-with-its-origin/).
66
67## Merging upstream
68
69When you are ready to send your code back to the upstream project,
70[create a merge request](../merge_requests/creating_merge_requests.md). For **Source branch**,
71choose your forked project's branch. For **Target branch**, choose the original project's branch.
72
73NOTE:
74When creating a merge request, if the forked project's visibility is more restrictive than the parent project (for example the fork is private, the parent is public), the target branch defaults to the forked project's default branch. This prevents potentially exposing the private code of the forked project.
75
76![Selecting branches](img/forking_workflow_branch_select.png)
77
78Then you can add labels, a milestone, and assign the merge request to someone who can review
79your changes. Then click **Submit merge request** to conclude the process. When successfully merged, your
80changes are added to the repository and branch you're merging into.
81
82## Removing a fork relationship
83
84You can unlink your fork from its upstream project in the [advanced settings](../settings/index.md#removing-a-fork-relationship).
85
86## Create a fork with the fork project form **(FREE SELF)**
87
88> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15013) in GitLab 13.11.
89> - It's [deployed behind a feature flag](../../../user/feature_flags.md), disabled by default.
90> - It's disabled on GitLab.com.
91> - It's not recommended for production use.
92> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-the-fork-project-form). **(FREE SELF)**
93
94This experimental version of the fork project form is available only if your GitLab
95administrator has [enabled it](#enable-or-disable-the-fork-project-form):
96
97![Choose namespace](img/fork_form_v13_10.png)
98
99To use it, follow the instructions at [Creating a fork](#creating-a-fork) and provide:
100
101- The project name.
102- The project URL.
103- The project slug.
104- Optional. The project description.
105- The visibility level for your fork.
106
107### Enable or disable the fork project form **(FREE SELF)**
108
109The new [fork project form](#create-a-fork-with-the-fork-project-form) is under
110development and not ready for production use. It is deployed behind a feature flag
111that is **disabled by default**.
112[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
113can enable it.
114
115To enable it:
116
117```ruby
118Feature.enable(:fork_project_form)
119```
120
121To disable it:
122
123```ruby
124Feature.disable(:fork_project_form)
125```
126