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 also suggests this file should be committed:
npm notice created a lockfile as package-lock.json. You should commit this file.
I don't want this file to be included in the line counts for the contribution activity on GitHub.
I've tried setting the files as vendored code in .gitattributes
, but that only affects the repository language.
Is there a way to exclude a file from the contribution activity without adding it to .gitignore
?
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 also suggests this file should be committed:
npm notice created a lockfile as package-lock.json. You should commit this file.
I don't want this file to be included in the line counts for the contribution activity on GitHub.
I've tried setting the files as vendored code in .gitattributes
, but that only affects the repository language.
Is there a way to exclude a file from the contribution activity without adding it to .gitignore
?
2 Answers
Reset to default 15One 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.
The signature of the --author
option: --author="NAME <EMAIL>"
git add package-lock.json
git commit -m 'initial commit' --author='nocontribute <>'
FOO_AUTHOR committed with REAL_AUTHOR x time ago.
Run
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global
to set the identity only in this repository.
binary
in.gitattributes
. I don't know if Github will respect that. – user1726343 Commented Jun 23, 2017 at 17:55