Skip to content

Add --commit flag to more easily lint a single commit #141

@WGH-

Description

@WGH-

The documentation suggests to use the following syntax for linting a single commit:

# Or specify a single specific commit in refspec format, like so:
gitlint --commits "019cf40^...019cf40"

https://jorisroovers.com/gitlint/#linting-a-range-of-commits

However, this syntax doesn't work for the initial commit, because it has no parent.

$ git log
commit 5bb07b5f891178c29bee44d0b18bc826d3e4b177
Author: WGH <wgh@torlan.ru>
Date:   Wed Aug 12 13:58:14 2020 +0300

    Initial commit
$ gitlint --commits 5bb07b5f891178c29bee44d0b18bc826d3e4b177^...5bb07b5f891178c29bee44d0b18bc826d3e4b177
An error occurred while executing '/usr/bin/git rev-list 5bb07b5f891178c29bee44d0b18bc826d3e4b177^...5bb07b5f891178c29bee44d0b18bc826d3e4b177': b"fatal: ambiguous argument '5bb07b5f891178c29bee44d0b18bc826d3e4b177^...5bb07b5f891178c29bee44d0b18bc826d3e4b177': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementUser-facing feature enhancements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions