Given I'm on first branch, tracking 'foo' and 'bar' files, like this:
my_repository/
./foo
./bar
How could I also track another branch (remote), where this 'foo' and 'bar' files are located under another location? I.e., when I checkout this second branch, my_repository
folder turns into something like this:
my_repository/
./some_file
./another_file
./tests/
../foo
../bar
Explaining a bit more: I have first branch tracking a remote repository, and second branch tracking another remote repository.
In some point, I cloned second repository somewhere-else, added foo
and bar
files to tests
folder, and commited it.
Then, I started commiting and making changes to my foo
and bar
files from my first branch, my oficial clone (origin/master). Now, I'd like to also send this changes to second repository, but not just overriding files's content. I'd like to have the commit history on the second branch too.
The problem is that this second repository place my files onto a different location.
Any tips?
It looks like you are looking for the subtree merge strategy (see also here).