Use case: I am logging my CI pipeline that deploys the tip of a specific branch of a repository.
Although plain, verbose English is always an option, a standardized format for representing a specific commit from a specific branch of a repository seems more appropriate.
I would imagine that such a notation would be indispensable for logging/documentation purposes; something along the lines of:
TIMESTAMP: REPO<separator1>BRANCH<separator2>COMMIT -> HOST
If this can be generalized across version control systems, all the better. My Google searches have not thrown up anything worthwhile on the subject.
There is no such settings and configurations for git itself to show repo, branch, commit together.
As Jonathon mentioned, the relationship among repo, branch and commit usually does not as 1:1:1.
And if you want to get if a certain commit belongs to a remote repo or a branch, or which repo, branch(es) the certain commit belongs to, you can use use scripts to achieve it. Main commands used for the script as:
Check a certain commit belongs to which branch(es):
git branch --contains <commit>
Check if a branch has tracking branch (in order to get the remote repo):
git rev-parse --abbrev-ref <branch>@{upstream}
Proposition
timestamp: repo/branch#commit -> HOST
e.g.
20200506_134321: my-site/master#c37107b0c -> HOST
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With