Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should the build directory be committed in a version controlled project?

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.

like image 907
henrywright Avatar asked Jan 01 '16 18:01

henrywright


People also ask

Should you push build folder to GitHub?

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.

Which command is used to create a .git folder in the existing project directory?

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.

How do you save changes from a local working directory to the staging area?

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 .


1 Answers

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.

like image 121
Guildencrantz Avatar answered Sep 28 '22 06:09

Guildencrantz