Git changelog: how to get all changes up to a specific tag?

前端 未结 9 1836
长情又很酷
长情又很酷 2021-01-31 09:37

Is there an easy way or command to get all git commits up to a specific tag to generate an automatic changelog for a project? I always tag my git repos with a version number lik

9条回答
  •  抹茶落季
    2021-01-31 10:13

    You may use Git Changelog Command Line to do this:

    npx git-changelog-command-line -std -tr v0.1.0 -tec "
    # Changelog
    
    Changelog for {{ownerName}} {{repoName}}.
    
    {{#tags}}
    ## {{name}}
     {{#issues}}
      {{#hasIssue}}
       {{#hasLink}}
    ### {{name}} [{{issue}}]({{link}}) {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
       {{/hasLink}}
       {{^hasLink}}
    ### {{name}} {{issue}} {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}
       {{/hasLink}}
      {{/hasIssue}}
      {{^hasIssue}}
    ### {{name}}
      {{/hasIssue}}
    
      {{#commits}}
    **{{{messageTitle}}}**
    
    {{#messageBodyItems}}
     * {{.}} 
    {{/messageBodyItems}}
    
    [{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*
    
      {{/commits}}
    
     {{/issues}}
    {{/tags}}
    "
    

提交回复
热议问题