# What to do if my Merge Time is high?

### Identify which team or repo <a href="#identify-which-team-or-repo" id="identify-which-team-or-repo"></a>

As a first step we should understand which team or repo is facing high merge times so that we can evaluate if that is expected or not given the business context and focus on them.

You can do this in the Cockpit, by switching to tabular view and sorting on merge time column.

<figure><img src="/files/IueMZB5xJvLsk4UN3xwC" alt="" width="563"><figcaption></figcaption></figure>

### Causes for high merge time

* **Merge Conflicts:** Conflicts between the branch being merged and the main codebase can occur, particularly if the branch has been out of sync for a while. Resolving these conflicts can take time, especially in large or complex projects.
* **Multiple Stakeholder Reviews:** Involving multiple stakeholders or requiring approvals from different departments can add layers of complexity and delay the merging process.
* **Technical Debt:** High levels of technical debt can make merging more difficult, as changes may need to work around or refactor existing code, which can slow down the review and merge process.
* **Prioritization Issues:** If reviewing and merging PRs is not prioritized, they may sit in the queue for longer, leading to higher merge times.

### How to reduce merge time

* **Automate Testing and CI/CD Pipelines:** Implement comprehensive automated testing (unit, integration, end-to-end) and continuous integration/continuous deployment (CI/CD) pipelines to catch issues early and streamline the merging process.
* **Use Feature Flags for Incremental Releases:** Implement feature flags to merge changes incrementally, even if the full feature is not yet complete. This keeps the codebase up-to-date and reduces the risk of merge conflicts.
* **Address Merge Conflicts Early:** Encourage developers to regularly rebase or merge the main branch into their feature branches to identify and resolve conflicts early.
* **Optimize Codebase for Merge Efficiency:** Refactor and modularize the codebase where possible to ensure that changes in one area have minimal impact on others, reducing merge complexity.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hivel.ai/improve-performance/how-to-improve-speed/what-to-do-if-my-merge-time-is-high.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
