Closed aaronjensen closed 6 years ago
I've been wanting to do something like this, too – I've legitimately been copy/pasting the commit title into the PR body when I open one. Very boring 😄
The only hesitation I've had is that I want to insert the full commit log between BASE and HEAD; I've yet to figure out how to do that. I'll prioritize it this weekend.
Hey @tarsius – do you know off the top of your head if there's anything in magit that would help me here? Otherwise I think I just have to run a git log
command myself (not a big deal; I just don't want to re-do existing work).
I cannot think of anything that Magit provides. Instead of git log
you probably can use git show -q
instead.
What does -q
do? I can't find it in the git-show
manpage.
Maybe it has --quiet
instead? If I remember correctly that suppresses the diff.
That is, an isearch on -q
showed no results. It's not online, either. Sounds like a ticket to git for an undocumented option? 😉
Or maybe I was wrong. You might want to test it before sending a mail. 😉
git show -q
definitely does something. It looks like it just shows HEAD
.
What you want is git show -q --format=%b REV
(instead of git log --oneline -1 --format=%b REV
, which you didn't spell out completely, which is why I omitted the details too).
Still looks like git-show only shows one commit.
I had something like git log --format=%H%n%B master..HEAD
in mind (where the master
would be the BASE branch). I.e., if I'm merging two commits:
deadbeefhash1
commit title
body...
deadbeefhash2
commit title
body...
Still looks like git-show only shows one commit.
Ah, I thought you wanted that. (Github only ever uses the commit message as template if the pr has only one commit.)
Which I think is silly 😄 we can do better.
Unless... do you think it would be better UX to just show a magit-log of changes to be merged in a buffer on the side? (And defaulting in the commit message if it's just one commit?)
FWIW, magit-gh-pulls uses the short message of all commits in the PR. I always delete them. Always. I've never wanted to open a PR w/ a list of my commits. I sometimes leave the first commit as the title in the case where I do a thing that is the main point of the PR, then commit it, then commit some other fix/cleanup/etc.
But usually I just delete them.
The one nice thing with it, however, is that I see an overview of all of my commits which may help me name my PR.
But usually I just delete them.
So not in the edit buffer, then. Would you not want it even there's only one commit? (i.e., HEAD~1 = BASE)
The one nice thing with it, however, is that I see an overview of all of my commits which may help me name my PR.
So definitely a plus for showing (magit-log "BASE..HEAD" (magit-log-arguments))
.
If it's just one commit, I'd love for its commit message to be the default PR message in the edit buffer.
Here's a question: what should we do if there's a PULL_REQUEST_TEMPLATE
?
My gut instinct is to just append the template to whatever we have.
IMO use it for the body and use the commit message first line for the title? Is that what GH does? I'd probably just do exactly what GH does.
thinking about it more, I like your idea. append the template to the first commit message--that works for me.
This is definitely one of those features I'm so glad to have done; it adds way more to the experience than I expected. Thanks for the issue!
Thanks!
I finally got around to testing this and it doesn't appear to work. Is there a var I have to set? I have a PR template in my repo
actually, it did work, I had to pick master
instead of HEAD
. I'm not sure why HEAD
is an option--it doesn't appear to work to create prs against... i would have thought it was the default branch
As discussed in #264, HEAD
shouldn't be an option. I'm investigating; thanks for the report 👍
@vermiculus looking for this feature I arrived here. Do I have to enable it in some way? I don't know why it's not working in my emacs.
It should work out of the box if you're just merging one commit. If you're merging multiple commits, there's no good way to choose a commit message, so we just show the commits you're about to request to merge. The only stuff you'd have to 'turn on' should be listed in magithub-feature-list
.
Both github and magit-gh-pulls use some combination of commit messages as the default message for a pull request if there is no template.
Specifically, I like github's behavior where, in the case of a single commit PR, the commit's message becomes the PR's title and description.
It'd be great if magithub did something similar. Thanks!