Your question is a little unclear about exactly what you need, but git
supports submodule
, that allows you to have your repository with one sub-folder that is another repository.
This would allow you to change content just in one sub-folder of your repository, not affecting you root repository.
You could have two repositories, with two branches in each of them:
Repository main-project
main-master
main-dev
Repository library
library-master
library-dev
In the repositories:
- main-master
- app
- modules
- lib --> git checkout library/lib-master
and
- main-dev
- app
- modules
- lib --> git checkout library/lib-dev
This structure allows you to checkout main-master
and have the correct version of lib
sub-folder.
At the same time, if you clone
the branch main-dev
to another directory, it will bring only the correct content.
To checkout
the root branch with the sub-branch, try: git clone <repo>:main-master --recursive
If this is what you need, you can see more about it in Git Documentation.
Or here on StackOverflow.
I'm not sure this is what you're looking for, but I hope it helps.
master
, and at the same time have another directory versioned on branchdev
and have both directories checked out. You can have only one branch checked out, and that will remove the other branch's directory.git status
on eithermaster
ordev
then both the branches say you have unstaged files that need to be added before commit. I want the files copied to be showen for commit only in dev branch.git commit
them into one, you will not see them in the other.