Afroz
Afroz

Reputation: 23

How do I run git update-index skip-worktree from nodeJS sccript

I know that git update-index skip-worktree can be used to ignore a file from any changes. I don't want to run this command manually on every system, how can I write a node js script to do this with a npm command.

Upvotes: 1

Views: 577

Answers (1)

VonC
VonC

Reputation: 1323973

You have approaches for formatting code (here or in okonet/lint-staged issue 170 which takes advantages of a script section of a package.json

You could use that for instance in the prepare step, which is run both before the package is packed and published, on local npm install without any arguments, and when installing git dependencies.

{
  "scripts": {
    "prepare": "git update-index --skip-worktree -- afile",
  }
}

Upvotes: 2

Related Questions