Up till now I’ve used version control for simple web-based projects that don’t really have a compile stage. I’ve now forked a relatively large project that follows the standard “./configure; make; make install” pattern. I’m unsure about the proper workflow for this type of project.
What do I do with all the created files from the compile process?
- Add lots of stuff to .gitignore? This is hard, because I did not create the build process and do not really understand everything that is created.
- Checkout the project somewhere else for each build? This seems like a pain, given that I often build every few minutes.
- Just make sure never to add something I don’t know about, i.e. never do
git add .If so, how do I cleanup now and then?
Obviously this is something everybody who deals with compiled code faces, so I’m sure there’s an accepted pattern, I just am not familiar with it yet.
I agree with ChrisF, don’t store binaries generated by the build in your repository. Your goal should be to have a nice .gitignore file, so that at any time running
git statusshould show no “untracked files”. That means git is either ignoring or tracking all files.One procedure I use to build my .gitignore is this:
add and commit all source to project (before anything was built)
cd projectgit add .git commit -m'initial import'add simple patterns of files that will be ignored to .gitignore; this includes tings like *.o, *.so.
echo '*.o' > .gitignoreecho '*.so' >> .gitignorethen I run the build.
makethen I run
git ls-files -o >> .gitignorewhich will pick up any outstanding files that are generated which you didn’t specify with glob patterns.
-Bart