File: web_editor.md

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (157 lines) | stat: -rw-r--r-- 6,061 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
---
stage: Create
group: Source Code
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
description: "Use the Web Editor to create, upload, and edit text files directly in the GitLab UI."
---

# Web Editor

DETAILS:
**Tier:** Free, Premium, Ultimate
**Offering:** GitLab.com, Self-managed, GitLab Dedicated

You can use the Web Editor to make changes to a single file directly from the GitLab UI.
To make changes to multiple files, see [Web IDE](../web_ide/index.md).

Your [primary email address](../../profile/index.md#change-the-email-displayed-on-your-commits)
is used by default for any change you commit with the Web Editor.

## Create a file

To create a text file in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the directory where you want to create the new file.
1. Next to the directory name, select the plus icon (**{plus}**) > **New file**.
1. Complete the fields.
   To create a merge request with your changes, enter a branch name
   that's not your repository's [default branch](branches/default.md).
1. Select **Commit changes**.

### From a template

To create a text file from a template in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the directory where you want to create the new file.
1. Next to the directory name, select the plus icon (**{plus}**) > **New file**.
1. In **Filename**, enter a name that GitLab provides a template for:
   - `.gitignore`
   - `.gitlab-ci.yml`
   - `LICENSE`
   - `Dockerfile`
1. From the **Apply a template** dropdown list, select a template.
1. Complete the fields.
   To create a merge request with your changes, enter a branch name
   that's not your repository's [default branch](branches/default.md).
1. Select **Commit changes**.

## Edit a file

To edit a text file in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the file you want to edit.
1. Select **Edit > Edit single file**.
1. Complete the fields.
   To create a merge request with your changes, enter a branch name
   that's not your repository's [default branch](branches/default.md).
1. Select **Commit changes**.

### Preview Markdown

> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/378966) in GitLab 15.6.

To preview a Markdown file in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the file you want to preview.
1. Select **Edit > Edit single file**.
1. Select the **Preview** tab.

You can see a live Markdown preview alongside your content.

To close the preview panel, select the **Write** tab.

### Link to specific lines

To link to single or multiple lines in the Web Editor, add hash
information to the filename segment of the URL. For example:

- `MY_FILE.js#L3` highlights line 3 in `MY_FILE.js`.
- `MY_FILE.js#L3-10` highlights lines 3 to 10 in `MY_FILE.js`.

When you edit a file, you can also link to a single line by selecting a line number.

## Upload a file

To upload a file in the Web Editor:

<!-- This list is duplicated at doc/user/project/repository/index.md#add-a-file-from-the-ui -->
<!-- For why we duplicated the info, see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/111072#note_1267429478 -->

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the directory where you want to upload the file.
1. Next to the directory name, select the plus icon (**{plus}**) > **Upload file**.
1. Complete the fields.
   To create a merge request with your changes, enter a branch name
   that's not your repository's [default branch](branches/default.md).
1. Select **Upload file**.

## Delete a file

NOTE:
You cannot delete a file from a [protected branch](../protected_branches.md)
without the necessary [permissions](../../permissions.md).

To delete a file in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the file you want to delete.
1. Select **Delete**.
1. In **Commit message**, enter a reason for the commit.
1. Choose between the following options:
   - To delete a file from the prefilled target branch, select **Commit changes**.
   - To delete a file from a new branch and commit changes:
     1. Select **Commit to a new branch**.
     1. Enter a branch name.
     1. Ensure the **Create a merge request for this change** checkbox is cleared.
     1. Select **Commit changes**.
   - To delete a file from a new branch, commit changes, and create a merge request:
     1. In **Target branch**, enter a branch name.
     1. Select **Commit to a new branch**.
     1. Enter a branch name.
     1. Ensure the **Create a merge request for this change** checkbox is selected.
     1. Select **Commit changes**.

## Create a directory

To create a directory in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Go to the directory where you want to create the new directory.
1. Next to the directory name, select the plus icon (**{plus}**) > **New directory**.
1. Complete the fields.
   To create a merge request with your changes, enter a branch name
   that's not your repository's [default branch](branches/default.md).
1. Select **Create directory**.

## Create a branch

To create a [branch](branches/index.md) in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Next to the repository name, select the plus icon (**{plus}**) > **New branch**.
1. Complete the fields.
1. Select **Create branch**.

## Create a tag

You can create [tags](tags/index.md) to mark milestones such as
production releases and release candidates. To create a tag in the Web Editor:

1. On the left sidebar, select **Search or go to** and find your project.
1. Next to the repository name, select the plus icon (**{plus}**) > **New tag**.
1. Complete the fields.
1. Select **Create tag**.