Proposal: Use squash-and-merge strategy for PRs #82
Replies: 9 comments 10 replies
-
I've always been a squash n' merge n' rebase fan, some folks on the team have been against it and shared the following resources against it:
|
Beta Was this translation helpful? Give feedback.
-
@WordPress/openverse-developers |
Beta Was this translation helpful? Give feedback.
-
I'm a fan of squash-and-merge. It's also what is used in the other WP repos I've interacted with and keeps the main branch history reading more like a changelog rather than a series of disperate commits intertwined by time (which could include lots of "address PR comments" type commit messages unless we became really annoyingly picky with how contributors decide to organize their own PRs... which seems like something we don't want to do if we want to promote community growth 🙂) |
Beta Was this translation helpful? Give feedback.
-
When working on a large change, sometimes I make successive PRs built on top of each other. This type of workflow would break down if the merged branch was squashed and the PRs targeting it broke down. |
Beta Was this translation helpful? Give feedback.
-
Can we use squash-and-merge for merging small branches into the main or large feature branches? Let me explain it using an example. Let's say we have one large feature branch, "Design Update". When individual PRs are merged into this feature branch, they are squashed. But when this whole "Design Update" branch is merged into |
Beta Was this translation helpful? Give feedback.
-
How do people feel about the following general approach? I don't even think it has to be a rule but best practices would be nice to encourage here, especially as some folks are learning to work this way. Large feature pull-requests with sub-pull requests
Examples:# ❌ Bad git log, too much functionality in one PR
# Sub-branches were squashed when added to the primary feature branch
# and the feature branch was also squashed when merged into main
a401d48c Add audio support to Openverse # ❌ Bad git log, too granular
# Sub-branches were not squashed when added to the primary feature branch
a401d48c Fix typo in audio track translation
a401d48c Add margin-left to play/pause button
a401d48c Fix broken logic in audio state
# ....and so on # ✅ Good git log, just the right level of detail
# Sub-branches were squashed when added to the primary feature branch
a401d48c Add view for single audio result
a401d48c Add audio files to the 'all' results view
# ....and so on Small pull requests (Most common)These are the most common types of pull requests. They implement a single feature that might modify a handful of files.
Examples# ❌ Bad git log, too granular
5b90ff78 Make 'notification' and 'report-content' modules namespaced
9aa833dc Make 'nav' module namespaced
5b17365f Make 'bug-report' and 'provider' modules namespaced
89100e33 Make 'active-media' and 'attribution' modules namespaced
c0ff2fb5 Make 'abtest' module namespaced
# ....and so on # ✅ Good git log, just the right level of detail
a401d48c Namespace Vuex modules I think as @AetherUnbound has suggested in different words, our guiding principle here should be to make time travel through the repository, namely rolling back changes, as easy as possible. In local development this is facilitated by small commits, but in production it's made significantly easier by having features chunked into clean, distinct commits. |
Beta Was this translation helpful? Give feedback.
-
Count me in with the use of squash-and-merge! 😄 Lately, I've been already following the second workflow Zack describes, and though it can get messy and should be done carefully paying attention, as this falls in more advanced git knowledge (with I have found myself in the situation of having to review an old intermediate commit a few times, and that was very helpful, but those have been very few, so it would be just a small loss. Seems like major scenarios and concerns are addressed, the authoring problem would have been a big one, I didn't know about it ❗️ Good thing it's solved! |
Beta Was this translation helpful? Give feedback.
-
As I understand, we have consensus on implementing Squash & Merge 🎉 I have made this the default merge strategy on all repositories. Thank you so much @AetherUnbound for gathering everyone to discuss this topic. |
Beta Was this translation helpful? Give feedback.
-
I'm going with the approach of actively disabling other merge commits (if a coding standard isn't enforced, it isn't a coding standard, is it?) If we run into issues we can enable them and encourage squashing manually, but I suspect that won't be necessary. |
Beta Was this translation helpful? Give feedback.
-
I would like to propose that we as a team adopt a policy to Squash-and-Merge PRs, rather than create merge commits via PRs. The intention of this change is to streamline our git history and make changes easier to track over time.
Pros
Cons
All that said, I'm in favor of squash-and-merge 😁 I can't count the number of times a clean git history has saved my hide. What do y'all think? Which strategy would you prefer?
Beta Was this translation helpful? Give feedback.
All reactions