I've encountered a problem when 2 branches were developed independently for a long time and one of the files was moved into another directory
Let's say we had a file called src/dir1/Main.cpp
and two branches branch1
and branch2
with common base
Then they were moved the file in branch1
and now it's called src/dir2/Main2.cpp
Of course both branches also modified that file independently
Now I want to rebase branch2
on top of branch1
and keep both changes in the file src/dir1/Main.cpp
(original one).
git checkout branch2
git rebase branch1
Git asks if I want to use modified or deleted version, I choose deleted one. Then I want to proceed with a merge of file branch1:src/dir1/Main.cpp
and <old_branch2_hash>:src/dir2/Main2.cpp
with the base of base:src/dir1/Main.cpp
. Is it possible to do with built-in git command (that possibly calls default mergetool
) or without using bash-like $()
syntax? I want it to work on both linux and windows systems and without bothering with manual copying of these files and calling a merge-tool on them.