Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress Github references from commit message to PR

Tags:

github

I have a branch in which I (automatically) apply some patches from pull requests.

I do so by committing the PRs' diff and have a commit message like this one

PATCHED | Apply patch https://github.com/randombit/botan/pull/386

Now every time I do that in a commit that is hosted on Github, the PR gets referenced.

In my case this does not add any value to the PR itself, as it is referenced multiple times and not part of any discussion. Can I suppress this referencing from my commit message?


This is what happens when I create a bunch of different commits that have a PR url in the commit message:

enter image description here

Here you can verify that totally unrelated commits create references just by commit message parsing:

  • https://github.com/webmaster128/dummy-github-ref-test
  • https://github.com/randombit/botan/pull/386
like image 923
Simon Warta Avatar asked Jan 03 '16 19:01

Simon Warta


1 Answers

One simple thing you could do is, not write the reference to the PR # in a way that github will parse it as such.

So, instead of

https://github.com/randombit/botan/pull/386

or

#386

you could try writing just

Pull request number 386

The fanciest thing that I could imagine doing is,

https://myserver.com/botan/pull/386

and then setup your server to redirect such queries to your github page... That way, you still get a clickable hyperlink in the commit messages, but you subvert github's referencing. It's a lot more effort than the alternatives though.

Edit: This is the most complete documentation I could find about github references in gfm. Here is some additional info about the parsing they do for 'closing issues via commit messages'. I couldn't find any more detailed documentation.

like image 127
Chris Beck Avatar answered Oct 07 '22 02:10

Chris Beck