Git, create a local branch (A) from the other two branches (B and C), and then merge from A to B without C files

I am developing a Magento module, and I have two repositories, this is my module, and the other is Magento itself. I clone my modular repo into a directory, and then add Magento repo as a remote and merge the two branches in one local branch, called testing. It is working fine. But during development, I need both projects (module and Magento) that open in the editor, so I edit the code in the test branch, and then I need to commit these changes. But I can’t just combine testing into a module branch, because I have Magento files in the test branch that I don’t need in the module branches.

Is there a way to merge changes from testing to the module branch without files from the magento branch?

The submodule and subtree did not work because my branches overlap their root directories, the module is not just a subdirectory of the magento branch.

Thank.

+3
source share
1 answer

Are you sure you want to merge the testing branch with the module branch? Although Magento files will not be present after the merge you are looking for, the entire history of Magento will be inextricably linked to your branch history of your module. Perhaps this is not what you want.

, , git merge --no-commit, Magento, , . , git revert -n -m1 <unwanted-merge-id>.

- . Magento , , .

( ) :

git rev-list --reverse --first-parent --no-merges ..testing | git cherry-pick --stdin

, , . . git reset --hard module - , , !

0

All Articles