A Gatsby source plugin for sourcing data into your Gatsby application from your local git repository. The plugin enables gatsby sites to include meta data about their own git repository at build time.
You can find a running example here: https://using-gatsby-source-local-git.netlify.app/
Missing a feature? Please create an issue (or even a pull request).
npm install --save gatsby-source-local-git
// In your gatsby-config.js
module.exports = {
plugins: [`gatsby-source-local-git`],
}
Sources of the example are available at examples/using-gatsby-source-local-git/
The plugin creates Commit
, Tag
, Branch
and Author
nodes.
{
gitCommit(latest: { eq: true }) {
hash
}
}
{
gitTag(latest: { eq: true }) {
name
}
}
Only tag names including a dot will be considered (like v1.2.3
or 1.2
but not newest-feature
).
{
gitBranch(current: { eq: true }) {
name
}
}
{
allGitAuthor(sort: { fields: name }) {
nodes {
name
email
}
totalCount
}
}