I use Git for source control and build with Visual Studio 2008. Mostly I build on one branch (master). Often I need to do a code review and switch to another branch (develop) temporarily. I do not build code that I review and after review is finished I switch back to the original branch:
- develop on master
- commit everything (branch is clean)
- build
- switch to develop
- do code review
- switch to master
- continue to develop on master
- build (recompiles many files, not only ones modified in previous step)
If master and develop have different versions of one file, the modification date and time for that file are updated to the moment of checkout after switching branches in step 5. This causes Visual Studio to rebuild them in the step 8 despite the fact that souce code have not changed.
How can I avoid massive rebuilds when changing branches?