如何从NodeJS脚本运行git update-index skip-worktree [英] How do I run git update-index skip-worktree from nodeJS sccript

查看:94
本文介绍了如何从NodeJS脚本运行git update-index skip-worktree的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道git update-index skip-worktree可用于忽略任何更改中的文件.我不想在每个系统上都手动运行此命令,我该如何编写一个节点js脚本以使用npm命令来执行此操作.

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.

推荐答案

您拥有格式化代码的方法(此处或在 问题170 ,它利用package.json的 script部分的优势 >

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

例如,您可以在准备步骤中使用它,该步骤在打包和发布软件包之前,在没有任何参数的本地npm install上以及安装git依赖项的同时运行. >

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",
  }
}

这篇关于如何从NodeJS脚本运行git update-index skip-worktree的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆