Web Editor (FREE)
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.
In the Web Editor, you can:
Your primary email address is used by default for any change you commit through the Web Editor.
Create a file
To create a text file in the Web Editor:
- On the top bar, select Main menu > Projects and find your project.
- From the project dashboard or repository, next to the branch name, select the plus icon ({plus}).
- From the dropdown list, select New file.
- Complete the fields.
- To create a merge request with the new file, ensure the Start a new merge request with these changes checkbox is selected, if you had chosen a Target branch other than the default branch (such as
main
). - Select Commit changes.
Create a file from a template
- On the top bar, select Main menu > Projects and find your project.
- On the left sidebar, select Repository > Files.
- Next to the project name, select the plus icon ({plus}) to display a dropdown list, then select New file from the list.
- For Filename, provide one of the filenames that GitLab provides a template for:
.gitignore
.gitlab-ci.yml
LICENSE
Dockerfile
- Select Apply a template, then select the template you want to apply.
- Make your changes to the file.
- Provide a Commit message.
- Enter a Target branch to merge into. To create a new merge request with your changes, enter a branch name that is not your repository's default branch,
- Select Commit changes to add the commit to your branch.
Edit a file
To edit a text file in the Web Editor:
-
On the top bar, select Main menu > Projects and find your project.
-
Go to your file.
-
In the upper-right corner of the file, select Edit.
If Edit is not visible:
- Next to Open in Web IDE or Open in Gitpod, select the down arrow ({chevron-lg-down}).
- From the dropdown list, select Edit as your default setting.
- Select Edit.
Keyboard shortcuts
When you edit a file in the Web Editor, you can use the same keyboard shortcuts for the Web IDE. See the available shortcuts.
Preview Markdown
Introduced in GitLab 15.6.
To preview Markdown content in the Web Editor:
- Edit a file.
- Do one of the following:
- Select the Preview tab.
- From the context menu, select Preview Markdown.
In the Preview tab, you can see a live Markdown preview alongside your content.
To close the preview panel, do one of the following:
- Select the Write tab.
- From the context menu, select Hide Live Preview.
Link to specific lines
Introduced in GitLab 13.11.
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 inMY_FILE.js
. -
MY_FILE.js#L3-10
highlights lines 3 to 10 inMY_FILE.js
.
To link to a single line, you can also:
- Edit a file.
- Select a line number.
Upload a file
To upload a binary file in the Web Editor:
- On the top bar, select Main menu > Projects and find your project.
- From the project dashboard or repository, next to the branch name, select the plus icon ({plus}).
- From the dropdown list, select Upload file.
- Complete the fields. To create a merge request with the uploaded file, ensure the Start a new merge request with these changes toggle is turned on.
- Select Upload file.
Create a directory
To create a directory in the Web Editor:
- On the top bar, select Main menu > Projects and find your project.
- From the project dashboard or repository, next to the branch name, select the plus icon ({plus}).
- From the dropdown list, select New directory.
- Complete the fields. To create a merge request with the new directory, ensure the Start a new merge request with these changes toggle is turned on.
- Select Create directory.
Create a branch
To create a branch in the Web Editor:
- On the top bar, select Main menu > Projects and find your project.
- From the project dashboard or repository, next to the branch name, select the plus icon ({plus}).
- From the dropdown list, select New branch.
- Complete the fields.
- Select Create branch.
Create a tag
You can create tags to mark milestones such as production releases and release candidates. To create a tag in the Web Editor:
- On the top bar, select Main menu > Projects and find your project.
- From the project dashboard or repository, next to the branch name, select the plus icon ({plus}).
- From the dropdown list, select New tag.
- Complete the fields.
- Select Create tag.