Question

Lets say I have a couple branches with different code: BranchA and BranchB. Assume I'm currently on BranchA and run a build. Suppose that my build dumps .class files and other compiled objects into directories within the work tree. When I run a diff, I see that directories have changed because they have new compiled objects within.

If I switch to BranchB and deploy my code, then I'm actually deploying objects compiled from BranchA's code base, since git maintained my floating changes (new compiled objects) across the branch switch. This is obviously a mistake.

There are a few ways to avoid this, one being cleaning up non-versioned files whenever we switch branches, but is there a more fool-proof way of taking care of this issue. I'd really rather not put compiled object into version control.

Was it helpful?

Solution

What I do

  1. use .gitignore to exclude compiled files from the repo
  2. make a clean and compile part of your deployment process.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top