Referencing git commit in the comment of Bugzilla

Adriaan de Groot adridg at
Fri Feb 5 11:24:20 UTC 2021

On Friday, 5 February 2021 01:46:44 CET Yasuhiro Kimura wrote:
> Doc and src have already migrated to git and ports will follow soon.
> In this situation it's quite possbile that bug reporter wants to
> reference git commit in the comment of bug report submitted to
> Bugzilla. Then is there standard(?) way to do it? As for subversion
> syntax such as "base r123456" or "ports r778899" is provided. And I
> expect similar one is provided for git.

Carrying on with two points:

- If you always want to see short hashes in `git log` and similar commands, 
you can configure it. Set `log.abbrevCommit` to true, for instance

	git config --global log.abbrevCommit true

  You can leave out `--global` if you only want to apply it to the "current" 
git repository, which is wherever your current working directory is.

- To address the nice-number-that-goes-up issue -- and remember, git is all 
branchy -- you can ask the question "can I follow commit history from hash A 
to hash B?". I'm not sure git can answer this question directly, but a 
question you **can** ask is "what is the shared ancestor commit of hash A and 
hash B?". If the answer is "A" then B is reachable from A, and A comes before 
B. If the answer is "B" then it's the other way around. And if there is some 
**other** answer, then the two hashes are not ordered -- for instance, when 
they are in different branches.

  Git provides the `merge-base` command to find that common ancestor, with a 
flag `--is-ancestor` to .. huh, to answer the original question and return a 
truthiness exit value, for instance:

git merge-base  --is-ancestor c5cc7822b0494e5474c2f305dda95aabeb64aa6f 
b8a9c4c3b78aa58e289dd9212f399e3f6af690b0 && echo yes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the freebsd-git mailing list