sindresorhus/refined-github

Preserve PR merge commit description when not squashing #3065

tiwanari posted onGitHub

<!-- Thanks for reporting a bug! ⛰ 1. Make sure the bug is caused by Refined GitHub. Try disabling the extension first. 2. Include a full URL where the bug appears. 3. Include a screenshot/gif Issues without a URL/screenshot will be closed -->

First of all, thank you for making this amazing extension!

Problem

#2564 clears up the PR merge commit description, which makes sense when squashing commits as the issue described, but it also clears the description when making a merge commit (not squashing).

When you make a merge commit, the description field is filled with the PR title, which is nice to have. Can we preserve it when not squashing commits?

How to reproduce

🐞 The extension enabled:

<img width="753" alt="enabled" src="https://user-images.githubusercontent.com/2739915/81138544-5a8c4100-8f9d-11ea-99e5-d96c8911bb3d.png">

✅ The extension disabled:

<img width="737" alt="disabled" src="https://user-images.githubusercontent.com/2739915/81138552-5eb85e80-8f9d-11ea-8167-3ee8d43963ed.png">


If anything the exception should be squashed commits, not merge commits:

With merge commits, the full “Fix punctuation” commit will appear in the history right below it; why also add it to the description?

If you don’t like the feature, you can disable the it.

posted by fregante almost 5 years ago

Let me elaborate this more. The example I provided above was not a good one.

For instance, let's say the title of a PR is Introduce Feature A and commits are like

  • Implement method X
  • Write tests for X
  • ...

The PR title would be a good summary when we merge the commits without squashing.

Sadly, I had to disable this feature for projects where people don't squash, but I'm working on several projects and this is a good feature for projects where people do squash. Just thought this feature was only for squashing commits according to the initial issue.

posted by tiwanari almost 5 years ago

Sadly, I had to disable this feature for projects where people don't squash

That's fair.

Let me elaborate this more. The example I provided above was not a good one.

Again, it applies to both merged and squashed commits:

Squashed commits

If you want to see the commits list:

  • click the PR link in the commit title

Merged commits

If you want to see the commits list:

  • click the PR link in the commit title
  • see the commits already below it in the git history ⬅️ ⬅️

There are already 2 ways to see commits in this case. If anything this feature makes more sense for merge commits than it does for squashed commits. 😅

Just thought this feature was only for squashing commits according to the initial issue.

Indeed, I mentioned squashed commits because that's what I generally use.

posted by fregante almost 5 years ago

Ah, I see. Sorry for my bad clarifications. What I want to see is not the commits but the PR title, and I was imagining that checking the PR title on my local machine not on GitHub. But you are suggesting I go to GitHub to see the PR title, which definitely works as a workaround:)

Sorry for confusing you by talking about commits (which is the main point of the feature) but it's more about the PR title.

Let me show an example using squash/non-squash PRs

$ git log
===== this is a squashed PR result (https://github.com/tiwanari/repo-for-issue-reports/pull/2) =====
commit (omitted)
Author: Tatsuya "Nari" Iwanari <tiwanari@users.noreply.github.com>
Date:   (omitted)

    Implement a cool feature (#2) <- Squash PR shows the title here

    (<-- Removed commits using the cleanup feature, which feels great:D -->)

===== the following commits are a non-squashed PR result (https://github.com/tiwanari/repo-for-issue-reports/pull/1) =====
commit (omitted)
Merge: 0503bf2 0e7b872
Author: Tatsuya "Nari" Iwanari <tiwanari@users.noreply.github.com>
Date:   (omitted)

    Merge pull request #1 from tiwanari/feature/test_merge_commits

    Implement an awesome feature <- I'm losing this PR title due to the cleanup

commit (omitted)
Author: tiwanari <tatsuyaw0c@gmail.com>
Date:   (omitted)

    Add tests for main.py

commit (omitted)
Author: tiwanari <tatsuyaw0c@gmail.com>
Date:   (omitted)

    Implement main.py

I personally love squash as it generates cleaner history but I also like making commits finely so that we can look back what changes people made and why easily.

posted by tiwanari almost 5 years ago

Anyway, it doesn't stop me from using this cool extension at all. It was just a little surprise when I noticed this situation.

posted by tiwanari almost 5 years ago

Hello! I just found out about this feature in refined-github, in my case was on merge squash not filling with the commit messages

I would just like to mention why is important for me first, what I need is to generate CHANGELOG.md with semantic-release + commit-analyzer, it's very useful and popular among npm libraries

@fregante you mentioned about disabling the feature, how can I do that with refined-github? I looked at the README.md but I couldn't find

posted by luan-orlandi-ifood over 4 years ago

@fregante you mentioned about disabling the feature, how can I do that with refined-github? I looked at the README.md but I couldn't find

@luan-orlandi-ifood : you can find and disable features of Refined GitHub in the extension's settings - about:addons ( Firefox ) / chrome://extensions ( Chrome ) and then finding the extension from the list. You can also right-click the extension's icon on the browser toolbar and click Manage Extension to get directly to the extension's page. On the extension's page, find the Preferences option. It will have a list of all the features that are enabled or disabled by Refined GitHub.

posted by shinenelson over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests