从GitHub贡献活动中排除package-lock.json [英] Exclude package-lock.json from GitHub contribution activity
问题描述
现在npm v5.0.0已经发布,使用npm软件包会在npm install
上自动生成一个package-lock.json
.就我而言,我的package-lock.json
文件恰好接近10,000行代码.
Now that npm v5.0.0 is out, using npm packages auto-generates a package-lock.json
on npm install
. In my case, my package-lock.json
file happens to be close to 10,000 lines of code.
Npm还建议应提交此文件:
Npm also suggests this file should be committed:
npm通知创建了一个锁定文件,作为package-lock.json.您应该提交此文件.
npm notice created a lockfile as package-lock.json. You should commit this file.
我不希望此文件包含在贡献活动在GitHub上.
I don't want this file to be included in the line counts for the contribution activity on GitHub.
我尝试将文件设置为.gitattributes
中的供应商代码,但这只会影响
I've tried setting the files as vendored code in .gitattributes
, but that only affects the repository language.
是否有一种方法可以在不将文件添加到.gitignore
的情况下将其从贡献活动中排除?
Is there a way to exclude a file from the contribution activity without adding it to .gitignore
?
推荐答案
从修改用户贡献活动中排除文件的一种方法是将提交与占位符作者相关联.这可以通过在--author
选项中提供一个空的电子邮件字段<>
来完成.
One way to exclude a file from modifying a user's contribution activity is by associating the commit with a placeholder author. This can be done by providing an empty email field <>
in the --author
option.
--author
选项的签名:--author="NAME <EMAIL>"
git add package-lock.json
git commit -m 'initial commit' --author='nocontribute <>'
FOO_AUTHOR在x之前与REAL_AUTHOR一起提交.
FOO_AUTHOR committed with REAL_AUTHOR x time ago.
这篇关于从GitHub贡献活动中排除package-lock.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!