Allow disabling "g" prefix for commit hash in version number
See original GitHub issueI’ve had multiple folks (including myself) be confused about the g
in front of the commit sha of a version number like 16.0.40-preview+ge6c3a1f9e4
.
You don’t immediately realize without knowing this convention that the g
isn’t part of the sha and wonder why you can’t find the commit. Is there a reason for the prefix or could there be an option to turn it off?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:14
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to manage the version number in Git?
Tags in Git can be used to add a version number. git tag -a "v1.5.0-beta" -m "version ... of commit's hash. The g...
Read more >Allow for the "-g" prefix to be part of the generated version ...
Currently this is not possible; the "commit-hash" part of the version number does not contain the -g prefix. Current behaviour:.
Read more >Git - git-commit Documentation
Create a new commit containing the current contents of the index and the given log message describing the changes. The new commit is...
Read more >Git - pretty-formats Documentation
The raw format shows the entire commit exactly as stored in the commit object. Notably, the hashes are displayed in full, regardless of...
Read more >Push rules | GitLab
Require expression in commit messages: Messages must match the expression. To allow any commit message, leave empty. Uses multiline mode, which can be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think the approach to fix this should be that we remove the
g
whenever the version.json file has opted into semver 2 for nuget packages. Or in other words, we use theg
only for nuget package versions, and only when using semver 1 rules (which is the default).It stands for git, and provides a more deterministic way to ascertain that what follows is the commit ID. I don’t remember where it came from (I didn’t invent the convention).
I’ve heard this feedback several times though, and I sympathize with the inconvenience of not being able to just double-click to select the “word” and paste it somewhere else without having to trim off the leading
g
.I’m not sure anyone even likes the leading
g
(as folks don’t tend to reinforce behavior that they like), so while an option to remove it seems perfectly reasonable, it’s worth considering simply removing it entirely, or at least making the option default to removal.I’m planning some breaking changes for a 3.0 version, and changing this behavior (or at least the default) would be well-placed for the 3.0 version, I think. And perhaps we can add the option in 2.3, but change its default in 3.0.