I have a shared git repository on bitbucket where I'm working on a part of a project and others are working on other parts. All the parts are each in a different folder On git the folder structure looks something like this:
rootdir
part_foo
part_foo2
part_mine
On my filesystem however The structures of my c++ project looks like this:
rootdir
bin
src
file1.cpp
...
fileN.cpp
test_data
The bin
and test_data
folder are not to be commited as they are for my use only.
So what I'd like to achieve is to have the content of my local src
folder to be synced with the content of part_mine
folder.
I've tryed both sparse-checkout and the solution proposed here, but they both are not the perfect solution as I end up having the part_mine
folder created inside the src
folder (or viceversa), which is kind of a problem for me.
So I'm asking if there's a way of telling git to think of my working directory as one specific directory in the remote tree. That would be that if I init
and remote
the git repository inside the folder src
I can then tell git that I'd like to push
/pull
inside a specific folder (i.e. part_mine
) and see all the file in there in src
and viceversa.
Thank you for your help!
The usual solution is to:
src
torootdir/part_mine
For any git operation, you go to yourRepo (for git add, commit, push)
For the rest, you work in
rootdir
as usual.