Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling workflow with version control

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.

like image 926
Tristan Avatar asked Jul 24 '10 15:07

Tristan


People also ask

Does workflows are possible in distributed version control system?

Distributed version control systems help software development teams create strong workflows and hierarchies, with each developer pushing code changes to their own repository and maintainers setting a code review process to ensure only quality code merges into the main repository.

What is the basic flow of version control?

Version control enables multiple people to simultaneously work on a single project. Each person edits his or her own copy of the files and chooses when to share those changes with the rest of the team. Thus, temporary or partial edits by one person do not interfere with another person's work.

What are the three types of version control?

The types of VCS are: Local Version Control System. Centralized Version Control System. Distributed Version Control System.


3 Answers

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 status should show no "untracked files". That means git is either ignoring or tracking all files.

One procedure I use to build my .gitignore is this:

  1. add and commit all source to project (before anything was built)

    cd project

    git add .

    git commit -m'initial import'

  2. add simple patterns of files that will be ignored to .gitignore; this includes tings like *.o, *.so.

    echo '*.o' > .gitignore

    echo '*.so' >> .gitignore

  3. then I run the build.

    make

  4. then I run

    git ls-files -o >> .gitignore

    which will pick up any outstanding files that are generated which you didn't specify with glob patterns.

-Bart

like image 131
bartman Avatar answered Oct 05 '22 13:10

bartman


To clean up your working directory, you can use git clean. It won't do any harm by default, unless you specify the -f (force) flag.

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

like image 22
cypheon Avatar answered Oct 05 '22 14:10

cypheon


Simple strategy is to store make output in another directory, e.g. build and then ignore this directory. You can configure it like this:

mkdir build && cd build && ../configure
like image 44
romario333 Avatar answered Oct 05 '22 12:10

romario333