title: Avoid recompilation with git and make
body: <p>I have two development branches in git and I frequently need to change between the two. However, the really frustrating thing is that every time I change branches in git, the entire project gets rebuilt because the file-system timestamps for some files will change. </p>
  
  <p>Ofc, the makefiles are configured to build the project into two different build directories .</p>
  
  <p>Is there any way around this? Compilation is a very long and time-consuming process... </p>
  
  <p>Edit:- This is a slightly more detailed explanation of the question... 
  Say I have a header files Basic.h which is included in a number of other files. Basic.h is different between branch 1 and branch 2. </p>
  
  <p>Now let's say I have compiled branch 1 into build_branch1 and branch 2 into build_branch2. Say I have branch 2 currently checked out. Now I checkout branch 1 and change File1.cpp and recompile. Ideally, since only File1.cpp has changed since I compiled it the last time, this is the only file that should be recompiled.</p>
  
  <p>However, since Basic.h has it's timestamp changed due to the checkout, all files that are including Basic.h will get recompiled. I want to avoid this. </p>