Skip to content

pindlebot/has-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

has-git

hasGit([cwd]): Promise<T | F>

  • Checks whether git is initialized for the project.

getConfig([cwd]): Promise<{}>

  • Returns the project's git config with git config --list

isDirty([cwd]): Promise<T | F>

  • Checks whether the project has untracked changes. Does not check for untracked files.
const { hasGit, getConfig, isDirty } = require('has-git')

hasGit().then(result => {
  console.log(result) // true
})

getConfig().then(result => {
  console.log(result) 
  /*
  {
    user: { 
      name: 'Steve', 
      email: 'steve@apple.com' 
    },
    core: { 
      repositoryformatversion: '0',
      filemode: 'true',
      bare: 'false',
      logallrefupdates: 'true',
      ignorecase: 'true',
      precomposeunicode: 'true' 
    },
    remote: { 
      origin: { 
        url: 'https://github.com/unshift/has-git.git',
        fetch: '+refs/heads/*:refs/remotes/origin/*' 
      } 
    } 
  }
  */
})

isDirty().then(result => {
  console.log(result) // true if untracked changes are present
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published