GitLab is a powerful DevOps platform that streamlines collaboration through features like merge requests (MRs), which enable code review, discussion, and controlled integration. However, there are times when you might need to delete a merge request — whether it’s obsolete, created by mistake, or no longer relevant.
In this article, you’ll learn when and how to delete a merge request in GitLab, and what alternatives to consider.
🔍 Can You Delete a Merge Request in GitLab?
By default, GitLab does not provide a “Delete” button for merge requests through the user interface. This is an intentional design decision to maintain transparency, preserve discussion history, and support audit trails.
✅ Instead of Deleting, You Can:
- Close the merge request
- Delete the source branch
- Mark it as “Won’t fix” or add a label like
invalid
- Restrict visibility (if you’re an admin or maintainer)
✅ Option 1: Close a Merge Request
To close a merge request (without merging it):
- Navigate to your project in GitLab.
- Click Merge Requests in the sidebar.
- Select the merge request you want to remove.
- Click the Close merge request button.
🔒 Only users with the appropriate permissions (Developer, Maintainer, or Owner) can close merge requests.
This action will keep the MR in your history, but clearly show it’s no longer active.
🧹 Option 2: Delete the Source Branch
If you want to clean up the associated branch:
- After closing the MR, go to the Repository > Branches page.
- Locate the source branch (e.g.,
feature/old-fix
). - Click the Delete icon next to it.
This helps remove unnecessary branches and avoid clutter.
🛠️ Admin Option: Delete via API (Advanced)
If you’re a GitLab admin or using a self-managed GitLab instance, you can technically delete merge requests via the GitLab API.
⚠️ Use with Caution – This is permanent!
Example using curl
:
curl --request DELETE --header "PRIVATE-TOKEN: <your_token>" \
"https://gitlab.example.com/api/v4/projects/<project_id>/merge_requests/<merge_request_iid>"
Replace:
<your_token>
with a personal access token<project_id>
with the numeric ID of the repository<merge_request_iid>
with the internal ID of the merge request
Note: This method is not available for most users on GitLab.com.
📌 Best Practices
- Avoid deleting merge requests unless absolutely necessary.
- Use labels and comments to document context or decisions.
- Keep discussions transparent for future reference and learning.
🔁 Summary
Action | Description |
---|---|
Close MR | Best way to remove it from the active list |
Delete branch | Clean up the source branch |
Use API | Admins only; irreversible action |
Add labels | Use invalid , wontfix , etc. for clarity |
Conclusion
While GitLab doesn’t allow direct deletion of merge requests through the UI, you can close, label, and delete branches to manage your workflow effectively. For most teams, closing the MR is the preferred approach, ensuring transparency and preserving valuable discussion history.
If you’re an admin or managing a private GitLab instance, API-level deletion is possible—but should be handled with care.