Reputation: 1271
Is there a way in git to commit a file but not count as part of the "additions" and statistics? Suppose you download a library and import it in your project, you did not write the library; how do you tell git not count the file as yours, but commit it?
Upvotes: 0
Views: 94
Reputation: 3301
As far as I know there isn't any way. The statistics (whichever you use) are not very smart. They just scrape the commits and summarize all the information in there; git itself has no control over the statistics.
Upvotes: 0
Reputation: 188
I do not think it is a good way to do it.
1, you do not need to commit the library to you git repo, you just have to use some library control (e.g npm for node, pip for python etc.) to get all required library. Then you need a file or somewhere to save the library list (e.g package.json for npm). That is easy way to do in the modern time
2, you can use submodule to link certain library/code from github/somewhere else. This is for those "library" that had not been published to npm/pip. Submodule will only link to the .git and only need to commit it once (as a whole submodule, not each file) unless you changed its code.
Upvotes: 4