Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

staged-git-files

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

staged-git-files

get a list of staged git files and their status

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
262K
decreased by-44.96%
Maintainers
1
Weekly downloads
 
Created

What is staged-git-files?

The 'staged-git-files' npm package is used to retrieve information about staged files in a Git repository. It allows developers to programmatically access details about files that have been added to the staging area, which can be useful for pre-commit hooks, linting, and other automated workflows.

What are staged-git-files's main functionalities?

List Staged Files

This feature allows you to list all staged files in the repository. The 'ACM' argument stands for Added, Copied, and Modified files. The callback function receives an error object and a results array containing details about each staged file.

const sgf = require('staged-git-files');

sgf('ACM', (err, results) => {
  if (err) throw err;
  console.log(results);
});

Filter Staged Files by Status

This feature allows you to filter staged files by their status. In this example, 'A' stands for Added files. The callback function receives an error object and a results array containing details about each added file.

const sgf = require('staged-git-files');

sgf('A', (err, results) => {
  if (err) throw err;
  console.log(results);
});

Custom File Status Query

This feature allows you to create a custom query for staged files by specifying an array of status codes. In this example, it retrieves files that are either Added ('A') or Modified ('M'). The callback function receives an error object and a results array containing details about each file matching the query.

const sgf = require('staged-git-files');

sgf(['A', 'M'], (err, results) => {
  if (err) throw err;
  console.log(results);
});

Other packages similar to staged-git-files

Keywords

FAQs

Package last updated on 03 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc