question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Version Control: Using squash merge when merging PRs to master

See original GitHub issue

In my opinion, when we merge PRs, we should be squashing the commits before merging it. A PR is usually related to one logical change as:

  • during the course of development, developers usually keep creating commits after small changes
  • whenever a PR is reviewed, new commits are made to address issues pointed in reviewer’s comments

Doing a squash would have the following advantages:

  • will keep out git history clean. Viewing the git log will clearly show how features were added/things were fixed.
  • will make it easier to check the change done by building a particular feature. Rather than viewing multiple commits git show <commit_id> will show the changes
  • will make it easier to revert a change
  • cherry picking a change to another branch(say release branch) would be much easier. 😃

It would be great if we could reach a consensus on this and start following the practise.

@misaochan @neslihanturan @nicolas-raoul @psh

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
misaochancommented, Mar 29, 2018

I agree with this, especially after having had to cherry pick through multiple-commit PRs recently. 😉

I think the simplest way to do this is for reviewers to use the web interface and click on the drop-down button then select “squash merge”. Given that it’s so simple, if we do decide to go with this, I’d personally prefer to request reviewers to all start right away for consistency (so that we don’t have some squashed commits along with a whole trail of unsquashed ones).

image

@nicolas-raoul No, senders don’t need to do anything special. 😃

1reaction
nicolas-raoulcommented, Mar 29, 2018

Good idea! It does not require the sender of a pull request to do anything special, right?

How about this:

  • Suggest that PR reviewers squash before merging
  • Since the PR reviewers are already overbooked, they are free to continue the way they are used to, and switch to doing it whenever they have time to experiment.
  • When all PR reviewers are used to squashing (could be in a year, we are not in a hurry), make it a rule.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Merge strategies and squash merge - Azure Repos
Squash merging is a merge option that allows you to condense the Git history of topic branches when you complete a pull request....
Read more >
Configuring commit squashing for pull requests - GitHub Docs
Under "Pull Requests", select Allow squash merging. This allows contributors to merge a pull request by squashing all commits into a single commit....
Read more >
Using git merge --squash to merge develop into master when ...
A merge from master to develop is needed by most repos that have a lot of activity when "hotfixes" come into play. Your...
Read more >
How to Squash Commits in Git | Learn Version Control with Git
When integrating commits from one branch into another, the 'squash' option allows you to combine multiple commits into one.
Read more >
Squash and merge - GitLab Docs
On the top bar, select Main menu > Projects and find your project. · On the left sidebar, select Settings > Merge requests....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found