-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get changelog between HEAD and most recent tag? #67
Comments
It can now give you the most recent tag matching a semantic version. You can construct a changelog between that tag and HEAD. |
Is there any way to not use semantic versioning for this request? I'm building an AMI build pipeline that I'd like to use something else (like the release date) as version. But I'd have to look back to either the most recent tag, or most recent tag named "release" or something. |
If you just want the most recent tag, perhaps this works? https://gist.github.com/rponte/fdc0724dd984088606b0 |
Am not having luck with 3.19 and getting tags. Is there a trick to what it's looking for? I pushed a tag to the remote: Added this to a pipeline step: But the printed value is empty. Also had to add script approvals for se.bjurr.gitchangelog.internal.semantic.SemanticVersion findTag and for orElse(). |
Are you sure Jenkins is fetching the tags? This is why I like to use the command line tool: Easier to fiddle with locally. |
I'm seeing this in the Jenkins build log, I thought --tags would be including the tags. I was wanting to avoid installing NPM stuff on the server just for debugging... 11:04:40 > git fetch --tags --progress --prune -- [email protected]:CCoE/chglog.git +refs/heads/master:refs/remotes/origin/master # timeout=10 |
I ment you can use the command line locally. It uses the same code. |
So, I'm a little lost. If I run "git tag", I get: If I run your utility, I get: I see 1.0.0 there on the remote. Is the code looking for a tag format in particular? EDIT: I see - the tag has to be of format: vx.x.x. |
Do you have just a few commits in the repo? A shallow clone maby? Is the tag on the first commit in the repo? |
I still can't figure out how to get what I need here. It's not making sense to me. I have a branch, with a git log including:
commit e482f40ba45fab3ecfc5b2d818d235be637e0fdb
commit 0f0f2259a6501377d811ee1b5c122e25fc139389
commit 56065b331d9fe444e71f215ec075e5036b8980cc (tag: 20220413)
commit e482f40ba45fab3ecfc5b2d818d235be637e0fdb
` So I've tried all the combinations of commits and refs I can think of, and the command line version keeps adding way more than between the HEAD and the tag or commit I'm trying to stop at (tag: 20220413, commit 56065b331d9fe444e71f215ec075e5036b8980cc): `npx git-changelog-command-line --from-commit 56065b331d9fe444e71f215ec075e5036b8980cc --to-commit HEAD -std --template template.txt
It's even stranger to me that it picks it's own place in the log to stop, that 3/4 date isn't the first commit. |
It would be easier to understand your use case if you supplied a graph like: |
The full graph, as in previous comment, and also the template being used would help understand this. I made a test in this repo: git clone [email protected]:tomasbjerre/git-changelog-lib.git
git checkout ba9d565 git log --oneline --graph
* ba9d565 (HEAD) More settings can be set from command line
* 3950c64 [Gradle Release Plugin] - new version commit: '1.1-SNAPSHOT'.
* 01484ce (tag: 1.0) [Gradle Release Plugin] - pre tag commit: '1.0'.
* 83a8a7b Doc
* 5c54861 Test
* 051effe Work for 1.0
* 5aaeb90 Initial commit
* a1aa5ff (tag: 0.0.1) Initial commit npx git-changelog-command-line --to-commit 01484ce -std -tec "
{{#commits}}
{{hash}}
{{/commits}}
"
01484ce71bbc76e
83a8a7b2f96ba88
5c54861708099d9
051effe72405e78
5aaeb907f68915a
a1aa5ff5b625e63 npx git-changelog-command-line --to-commit HEAD -std -tec "
{{#commits}}
{{hash}}
{{/commits}}
"
ba9d565ddd15d1b
3950c640e41f436
01484ce71bbc76e
83a8a7b2f96ba88
5c54861708099d9
051effe72405e78
5aaeb907f68915a
a1aa5ff5b625e63 npx git-changelog-command-line --from-commit 01484ce --to-commit HEAD -std -tec "
{{#commits}}
{{hash}}
{{/commits}}
"
ba9d565ddd15d1b
3950c640e41f436 |
OK, let me give something concrete. Maybe you can correct my understanding. I have a git history like: ===============================================================
commit e482f40ba45fab3ecfc5b2d818d235be637e0fdb
commit 0f0f2259a6501377d811ee1b5c122e25fc139389
commit 56065b331d9fe444e71f215ec075e5036b8980cc (tag: 20220413)
========================================================= and the git online requested looks like: =========================================================
=============================================================== What I'm trying to do is get a changelog between the HEAD and to the tagged (20220413, commit 56065b331d9fe444e71f215ec075e5036b8980cc) on that branch. but I seem to keep going back farther, to commit 7897ca98ea38b16feb40d36cf70e61861580a55e. Am I being stupid because there's a merge in there? |
This is intended. 7897ca9 is in the parents of HEAD and not in the parents of 20220413. |
Perhaps this helps: |
Describe your use-case which is not covered by existing documentation.
Is there any way to get the changes between the top of the repor (HEAD) and the most recent of some matching tag? I need to create a changelog for what changed between HEAD and the last "release" that was done.
I'm trying to use the pipeline version of this, but I see no options for this in the snippets generator. As far as tag refs, all I see is a fixed reference to 'git-changelog-1.50', but no other samples.
Can you explain tag refs a little better? Thanks.
Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
Request reopen of #66
Sorry, but how does this change help? I am trying to get a changelog between tags. This change appears to be how to get a version number. Can you explain?
The text was updated successfully, but these errors were encountered: