I have my main_repo with folder structure like this
application_root
It's the main application. And I have another repo with an extension for my main application. The problem is that extension directory layout overlap directories from the root of main project such as
extension_root
So I can't use submodule tool. I need to merge this two repositories for farther development. I need the ability to merge from extension_repo to main_repo and back as well so if I made changes to my extension which was merged to main_repo I can merge only this changes (without application itself) to extension_repo. I don't know if it even possible. It seems that read-tree merging do what I want but I can't use it in such way
git read-tree --prefix=/ -u extension_remote_branch
because I get this error
error: Entry '.gitignore' overlaps with '.gitignore'. Cannot bind.
I guess I'll get this error for all directories I have overlaped. I don't actually have overlaped files except of .gitignore.
Usually a three-way merge by git read-tree resolves the merge for really trivial cases and leaves other cases unresolved in the index, so that porcelains can implement different merge policies.
Git merge will combine multiple sequences of commits into one unified history. In the most frequent use cases, git merge is used to combine two branches.
Tree Objects When using PowerShell, parameters using {} characters have to be quoted to avoid the parameter being parsed incorrectly: git cat-file -p 'master^{tree}' . If you're using ZSH, the ^ character is used for globbing, so you have to enclose the whole expression in quotes: git cat-file -p "master^{tree}" .
So far I haven't found a way to do this in a single command via git; so instead I use a fairly straightforward workaround. The basic approach is to read-tree
into a second, empty directory. Then move the second directory overtop the first.
The basic flow is:
mkdir upstream-tree
git read-tree --prefix=upstream-tree/ -u myremote/branch
git commit -m "Pulled in remote tree"
cp -rf upstream-tree/* local-tree/
git rm -r upstream-tree
git add local-tree
git commit -m "Merged upstream-tree into local-tree"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With