> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Intro to Merge Requests

> GitLab Merge Requests facilitate collaborative development by allowing teams to propose, review, and integrate code changes between branches.

GitLab Merge Requests (MRs) are the cornerstone of collaborative development in GitLab. They enable teams to propose, review, and integrate code changes from one branch into another. While MRs serve the same purpose as [GitHub Pull Requests](https://docs.github.com/en/pull-requests), they use different terminology and offer seamless integration with GitLab’s built-in CI/CD.

## What Is a Merge Request?

A Merge Request lets you:

* Propose changes from a **source branch** to a **target branch** (typically `main` or `master`).
* Collaborate through comments, inline code discussions, and approvals.
* Enforce quality gates by requiring passing CI/CD pipelines before merging.

<Callout icon="lightbulb" color="#1CB2FE">
  Give your Merge Request a clear title and description. Assign reviewers early to accelerate feedback.
</Callout>

## GitLab vs. GitHub: Core Concepts

| Concept               | GitLab Merge Request                                                                      | GitHub Pull Request                                              |
| --------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| Feature Name          | Merge Request                                                                             | Pull Request                                                     |
| Default Target Branch | `main` (configurable)                                                                     | `main` (or `master`)                                             |
| CI/CD Integration     | Built-in [GitLab CI/CD pipelines](https://docs.gitlab.com/ee/ci/)                         | External or [GitHub Actions](https://docs.github.com/en/actions) |
| Draft Mode            | [Work in Progress MR](https://docs.gitlab.com/ee/user/project/merge_requests/drafts.html) | Draft Pull Request                                               |

Despite these differences, both platforms follow a similar review workflow:

1. Create a feature branch
2. Commit your code
3. Submit for review
4. Discuss and revise
5. Merge into the main codebase

## Typical Merge Request Workflow

### 1. Create a Feature Branch

```bash theme={null}
git checkout -b feature-xyz
```

### 2. Develop and Commit Changes

```bash theme={null}
# Edit files...
git add .
git commit -m "Implement feature XYZ"
```

### 3. Push to the Remote Repository

```bash theme={null}
git push -u origin feature-xyz
```

### 4. Open a Merge Request

1. Go to **Merge Requests** → **New merge request** in your GitLab project.
2. Select `feature-xyz` as the **Source branch** and `main` as the **Target branch**.
3. Add a descriptive title and detailed description of your changes.

### 5. Review and Iterate

* Reviewers leave comments or suggestions.
* Address feedback by pushing follow-up commits:
  ```bash theme={null}
  git add .
  git commit -m "Address review feedback"
  git push
  ```

### 6. Merge When Ready

Once all approvals are in place and CI pipelines succeed, click **Merge**.

<Callout icon="triangle-alert" color="#FF6B6B">
  Do not merge if the pipeline has failed. Failing tests or lint errors will propagate into your main branch.
</Callout>

## Links and References

* [GitLab Merge Requests Documentation](https://docs.gitlab.com/ee/user/project/merge_requests/)
* [GitLab CI/CD Overview](https://docs.gitlab.com/ee/ci/)
* [GitHub Pull Requests Guide](https://docs.github.com/en/pull-requests)
* [GitLab Best Practices](https://docs.gitlab.com/ee/topics/best_practices.html)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/gitlab-ci-cd-architecting-deploying-and-optimizing-pipelines/module/fbf7cb8d-dcca-444e-a547-7bdb8b725634/lesson/6eb63fab-fe9c-4795-aad0-53e49a120476" />
</CardGroup>
