Use of worktree
is best for this purpose.
In my case, I have two version of the same software that the basics are the same but each version has some different features.
So I create two worktree
that means, create two relevant long-running branches beside the master.
$git worktree add -b version-silver ..\version-silver master
$git worktree add -b version-gold ..\version-gold master
Then I have:
$git branch
master # base stuff here
version-silver # some normal features
version-gold # some better features
There is one repository, but I have 3 separate folders beside each other for each branch above. And make the common changes in master. then merge it with both other versions.
cd master
vim basic.cpp
git add .
git commit -m "my common edit on basic.cpp"
cd ..\version-silver
vim silver.cpp
git add .
git commit -m "my specific edit on silver.cpp"
git merge master # here i get the basic.cpp latest changes for silver project
cd ..\version-gold
git merge master # here i get the basic.cpp latest changes for gold project
Specific changes of each version will go in the corresponding folder as well, and the works on each project are isolated and IDE wouldn't be confused.
Hope that helps.