Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace merge with rebase for cleaner history #3597

Closed
samyuh opened this issue Jan 12, 2025 · 3 comments
Closed

Replace merge with rebase for cleaner history #3597

samyuh opened this issue Jan 12, 2025 · 3 comments

Comments

@samyuh
Copy link
Contributor

samyuh commented Jan 12, 2025

I'm suggesting to use rebase instead of merge when incorporating changes from one branch to another.

Rebase helps maintain a cleaner, linear commit history by replaying the commits from the current branch on top of the target branch. This approach avoids the creation of unnecessary merge commits and ensures a more streamlined history, making it easier to track changes and manage the repository.

To achieve this, it's only necessary to change one config in the repository settings.

@samyuh samyuh changed the title Use rebase instead of merge Replace merge with rebase for cleaner history Jan 12, 2025
@minrk
Copy link
Member

minrk commented Jan 13, 2025

Thanks for the suggestion, but merge commits serve a useful purpose and make the changes from a PR clearer, and better represent the reality of development, and I think it is super important to avoid asking contributors to 'clean up' their history in PRs, which rebased linear history encourages. Rebasing during review should generally be discouraged, because it makes tracking changes since last review much more challenging.

A combination of merge (most of the time) and squash & merge (only where history has grown significantly out-of proportion to the change) is generally what we follow and offers the best balance of history and contributor support.

@samyuh
Copy link
Contributor Author

samyuh commented Jan 13, 2025

Thank you for your insight. I'm more used to rebase and squashing, and I always thought it provided advantages over merge requests. However, after your explanation, I see it's really a tradeoff, and in this case, I now consider merge requests to be valuable for open-source projects like this.

@minrk
Copy link
Member

minrk commented Jan 13, 2025

Thanks! Yeah, it's always tricky with trade-offs, there's definitely not just one right answer.

@minrk minrk closed this as completed Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants