Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7861389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:42:45+00:00 2026-06-02T22:42:45+00:00

I have two development branches in git and I frequently need to change between

  • 0

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.

Ofc, the makefiles are configured to build the project into two different build directories .

Is there any way around this? Compilation is a very long and time-consuming process…

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.

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.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:42:47+00:00Added an answer on June 2, 2026 at 10:42 pm

    Git changes only the files that are updated between branches. But if your compiler does a full rebuild even if any single file was changed you can always clone and checkout your different branches into different directories. That’s like:

    /your-repo-name.branch1
    /your-repo-name.branch2
    

    This takes extra disk space but is much more convenient than switching divergent branches in a huge repo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

git version 1.7.7.4 I have two branches development and testing . Originally testing was
I have a project that's consisted of two branches: STABLE and DEVELOPMENT. As the
I have two build definitions for my project which has two branches. Development and
I have a typical Subversion set-up: /trunk /branches/client-one /branches/client-two /branches/client-three Trunk holds main development
I'm new to Rails development. I have two models, Decision and Choice. Every decision
I have two branches from trunk in TFS that say Dev and Release. Right
I have a github-based git repository that represents development up to a certain point,
I have two repo's which I'd like to keep separate. One for development, branches
I have two development machines. One machine is setup to use a specific Mercurial
I have now witnessed two companies move to agile development with Scrum. In both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.