I'm in the process of version controlling my project. I have commited the project source code using an src/ directory.
My question is, should I commit my build/ directory (sometimes called dist/ or bin/ depending on the application) when using version control?
Please explain why in any answer you give. Thanks in advance.
The only important structure in Git is the history. and don't push the build branch to your main repo, you don't want that history there so don't push it there.
The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository.
First, you edit your files in the working directory. When you're ready to save a copy of the current state of the project, you stage changes with git add . After you're happy with the staged snapshot, you commit it to the project history with git commit .
Unless you're specifically using git push
as a distribution mechanism the general answer is no. The reason being that in most cases the build is idempotent and based on the source that's in version control, so if you need to recreate the build directory you simply re-run your build process. This will save you space in your repositories and possibly prevent platform/architecture issues depending on your language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With