Version Control Workflow Compilation

So far, I have used version control for simple web projects that do not actually have a compilation stage. Now I have developed a relatively large project that follows the standard template "./configure; make; make install". I am not sure of the correct workflow for this type of project.

What should I do with all created files from the compilation process?

  • Add a lot of things to .gitignore? This is difficult because I did not create the build process and do not understand everything that was created.
  • Design a project in a different place for each assembly? This seems like a pain, given that I often build every few minutes.
  • Just remember to add something that I don't know about, i.e. never do git add . If so, how do I clean now and then?

Obviously, this is everyone who deals with compiled code persons, so Iโ€™m sure that there is an accepted template, I am not familiar with it yet.

+6
git version-control autotools
source share
4 answers

I agree with ChrisF, do not store the binaries generated by the assembly in your repository. Your goal should be to have a nice .gitignore file, so that at any time running git status should not show any โ€œraw filesโ€. This means that git ignores or tracks all files.

One procedure that I use to create my .gitignore is the following:

  • add and commit the entire source for the project (before anything was created)

    cd project

    git add .

    git commit -m'initial import'

  • add simple file templates that will be ignored before .gitignore; this includes things like * .o, * .so.

    echo '*.o' > .gitignore

    echo '*.so' >> .gitignore

  • then I started the assembly.

    make

  • then i ran

    git ls-files -o >> .gitignore

    which will select any outstanding files that were generated that you did not specify using glob templates.

-Bart

+6
source share

To clean the working directory, you can use git clean . By default, it will not hurt unless you specify the -f (force) flag.

The git clean -xfd command line will delete everything in your working directory that is not in version control.

+4
source share

A simple strategy is to store the output of the output in another directory, for example. build, and then ignore this directory. You can configure it as follows:

 mkdir build && cd build && ../configure 
+3
source share

You cannot place intermediate or output files under source control. If you did, you would have to check them so that the files are written every time you compile and build the solution.

You are not saying which IDE (if any) you are using - check to see if it can add the project to the original control for you. If he can use this option, as he will add only those files that are absolutely necessary.

+1
source share

All Articles