K
K
klirichek2015-02-19 11:46:57
git
klirichek, 2015-02-19 11:46:57

How to merge with git a source file split into several parts?

In the current branch of the project, one large .cpp file was refactored and split into several small ones (no changes were made, pure copy-paste).
However, in the stable branch, everything remains the same.
Time passes, tickets are opened, bugs are fixed, fixes are committed to the stable branch.
And now the time comes when the fixes need to be merged into the current development branch as well.
The problem is this: let's say there was a fix in the foo() function. The fix is ​​trivial; all the necessary context is available. But! Now this function is already in another file! Accordingly, a conflict arises during the merge: ("in their" branch there are changes relative to the common ancestor, and "in our" this function is no longer there at all). Yes, you can manually roll the patch to the right place in the new file (as a result, I had to do this).
I've heard that git is pretty good at keeping track of file renames. But here is a different case: we are talking about transferring a piece of text from one file to another.
Is it possible to automatically monitor such a situation?
(Well, once I merge manually. But the situation will not change in the future! The next merge, it turns out, will also need to be done manually? Or can it be automated somehow?)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question