Giter VIP home page Giter VIP logo

git-releaselog's Introduction

git-releaselog

Gem Version Build Status Code Climate Test Coverage

This tool generates a release log from a git repository.

Its hard or even impossible to generate good releaselog from an ordinary git log. The git log usually contains very detailed, technical information, targeted at the maintainers of a project.

In contrast, the releaselog should be targetet at the users of a project and should describe changes relevant to those users at a higher abstraction.

Thats why this tool does not attempt to build a releaselog from normal commit messages but instead requires special keywords to mark notes that should show up in the releaselog.

These keywords can be used in commit messages.

As an example, check out the changelog for this repo which is automatically generated using this tool. Furthermore, the git release messages are also generated with this tool, see this release for example.

Installation

gem install git-releaselog

Troubleshooting

If you are having problems with installing the rugged dependency, maybe you need to install cmake:

brew install cmake

Check out the Install Instructions of the rugged gem.

Usage

The default use is to generate the releaselog starting from the last release (the most recent tag) until now.

  • git-releaselog: will look up the most recent tag and will search all commits from this tag to HEAD.

If you want to controll the range of commits that should be searched, you can specify a commit-hash or tag-name, e.g.

  • git-releaselog v1.0 will look up the commits starting from the tag with name v1.0 to HEAD.
  • git-releaselog v1.0 7c064bb will look up the commits starting from the tag with name v1.0 to the commit 7c064bb.

Alternatively, you can choose the generate the whole releaselog for the whole repo:

  • git-releaselog --complete will search the whole git log and group the changes nicely in sections by existing tags.

To control the markup of the output, you can use the --format option (the default is slack):

  • --format slack produces output that looks nice when copy/pasted into slack
  • --format md produces markdown output in reverse order, e.g this repo's releaselog

Markup

Entries that should show up in the releaselog must have a special format:

* <keyword>: [<optional-scope] <description>

The descriptions are extracted from the git history and grouped by keyword. Currently, the following keynotes are supported

  • fix
  • feat
  • gui
  • refactor

Scope

The releaselog can be limited to a certain scope. This is helpful when multiple projects / targets are in the same git repository (E.g. several targets of an app with a large shared codebase).

When a scope is declared for the generation of the releaselog, only entries that are marked with that scope and entries without scope are included into the releaselog.

Example

Given these lines in a commit message:

* feat: [project-x] add a new feature to project-x
* fix: [project-y] fix a bug in project-y
* fix: fix a bug that affected both projects

running

git-releaselog --scope project-x

will generate this releaselog:

*Features*
* add a new feature to project-x

*Fixes*
* fix a bug that affected both projects

Usage suggestion

This is just what works best for us:

  • Use guidelines for git commits, e.g. AngularJS
  • Use the Gitflow workflow
  • Create Merge Requests for merging feature branches back to develop
    • Feature branch / merge request should address specific features / fixes / ...
    • The description of the merge request should contain markup for the releaselog
    • The description of the merge request should be the commit message of the merge commit (done automatically e.g. by gitlab, manually for github!)

The only additional step from our normal workflow is to use special markup for the change log in the description of a merge request. Doing so enables the generation of change logs between arbitrary commits / releases

Example

The following is an excerpt of the this repos git log:

commit fa40cdb51c674df8b4a564e283a601d50fcdd55f
Author: MeXx <[email protected]>
Date:   Tue May 26 14:04:09 2015 +0200

    fix(repo): back to the local repo

commit 1f4abe3399891cfd429e5aa474e6c414f7e2b3b2
Author: MeXx <[email protected]>
Date:   Tue May 26 14:02:47 2015 +0200

    feat(releaselog): new feature to create a complete releaselog
    
    * feat: use the `--complete` parameter to generate a complete releaselog over all tags

commit 61fe21959bb52ce09eaf1ee995650c8c4c3b073e
Author: MeXx <[email protected]>
Date:   Tue May 26 13:18:10 2015 +0200

    refactor(searchChanges): moved the function to search the git log into a function

commit d41dac909757b265d226589ead6a5a57aba5dc87
Author: MeXx <[email protected]>
Date:   Tue May 26 12:49:00 2015 +0200

    feat(printing): nicer printing of the log

Notice, that commit 1f4abe3399891cfd429e5aa474e6c414f7e2b3b2 has an extra line with a feat keyword. The releaselog for these commits looks like this:

git-releaselog d41dac9 fa40cdb --format md
## Unreleased
(_26.05.2015_)

#### Feature
* use the `--complete` parameter to generate a complete changelog over all tags

git-releaselog's People

Stargazers

 avatar

Watchers

 avatar  avatar

git-releaselog's Issues

Option to skip Version Header

Currently, the Version Header (Current-Tag + Date) is always generated. When using the Changelog in a Github Release Message, the information is redundant, because the version is already a separate attribute of the release.

So, it would be nice to be able to skip the Version Header

Changelog uses date from wrong tag for release message

When calling git-changelog for my project like this: git-changelog 0.9.0 0.8.0 --format slack it contains a line like the following: Version 0.9.0 (_03.09.2015_)

But 03.09.2015 is in fact the date of the tag 0.8.0. Instead, I would have expected it to pick up the date from the tag 0.9.0, which would be 17.09.2015.

I think the cause may be this line and this line (this should probably be DRYed up by abstracting the information retrieval to a new class for example), which should be str << " (_#{@commit_from.time.strftime("%d.%m.%Y")}_)" (from instead of to) instead.

Print the next tag name instead of "Unreleased"

When generating the Changelog with a to_ref which does not exist as tag, we could assume that that is the name for the next release and thus print the name instead of "Unreleased"

E.g. See https://github.com/iv-mexx/git-releaselog/blob/master/CHANGELOG.md
This Changelog was generated for the release "0.7.0", but before the tag was created (--> The updated changelog should be part of the tag, so the tag needs to be created later than the changelog).

Rename the project

Since git-changelog is already taken on rubygems, it would probably be good to change the project's name rather sooner than later.

Some suggestions to get us started (all of them are available on rubygems), but please feel free to pick whatever you like: gitch, git-releaselog, git-whatsnew

NoMethodError when not providing a to_ref in case no to_ref argument is given on CLI execution

The stripping of from_ref_name and to_ref_name from 6b24431 causes errors in case one of them is nil.

For example with the execution of git-releaselog 0.10.0 (without a to_ref, the expectation being that a releaselog is generated from 0.10.0 up to the current commit):

git-releaselog-0.7.1/lib/git-releaselog.rb:12:in `generate_releaselog': undefined method `strip' for nil:NilClass (NoMethodError)

In Rails you could think about handling such cases with NilClass.try?, but Iโ€™m not perfectly sure this is how it should be handled here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.