问题
I know that it is considered a bad practice to commit generated files to a git repository. But how to deal with bower?
Currently my library is built into a dist/
directory which gets ignored by a .gitignore
file. I don't want generated files pushed to the repository. The problem is that the library is also distributed as a bower component.
How can I reference the generated assets into my bower component when a new version got released? Should I create another repository to store those files? Should I commit those files to the git tagged version?
回答1:
You've already mentioned your choices. There aren't really a best way. Choose what you prefer. Either create a new repo or commit the /dist
folder. Both have upsides and downsides. Creating a repo makes it more cumbersome to update and committing makes the repo more bloated.
The Bower team is working on a way to publish releases to a server, which will resolve this issue.
回答2:
I would like to challenge the idea that committing built files is a bad practice, and I do that in this question.
About handling built files with git, check also this excellent post.
来源:https://stackoverflow.com/questions/19029726/dealing-with-git-generated-files-and-bower