Syndication Icon
Published June 13, 2020 Updated June 13, 2020

Git Lint

  • Duration

    02:06

  • Operating System

    macOS

  • Shell

    bash

  • Terminal

    xterm

Transcript

# Hello and welcome to the Alchemists Screencasts!
# Today, we'll look at Git Lint (https://www.alchemists.io/projects/git-lint).

# For demonstration purposes, an *tutorial* project has been created:

tree

# We can get started by creating a feature branch:

git switch --create test --track

# Then we can run Git Lint to check the status of this branch:

git-lint --analyze

# We have no issues because we haven't made any commits yet.
# Let's add one:

touch test.txt
git add test.txt
git commit --message "Add test file"

# Let's run Git Lint to see how we did:

git-lint --analyze

# We've got some errors and warnings so let's fix them:

git commit --amend
ghow

# Notice I fixed the commit subject prefix and suffix.
# Let's see what Git Lint has to say:

git-lint --analyze

# Great, the errors are gone but have a warning left.
# While a warning won't fail the program or a build, it's a good idea to fix too.

git commit --amend

ghow

# Let's see what Git Lint says:

git-lint --analyze

# While the warning is gone, I introduced more errors.
# Notice how Git Lint explains what I did wrong and points out which lines are affected.
# Lets fix those errors:

git commit --amend

ghow

# Let's run Git Lint again:

git-lint --analyze

# Excellent, we have a valid commit.
# Despite not having many commits in this repository:

gl

# ...we can check individual commits if desired:

git-lint --analyze --commits

# While this commit is not part of our feature branch, we can see it doesn't have errors.
# We can also check multiple commits at once:

git-lint --analyze --commits

# For more details on how to wire up Git Hook/Continous Integration, etc...
# ...make sure to check out the Git Lint README.

# Enjoy!
# https://www.alchemists.io
# ☿ 🜔 🜍 🜂 🜃 🜁 🜄