title: How to get git to correctly merge moved content (not only files)
body: <p>I am currently looking at a lot of the content tracking features of git. It is very nice to know that git allows me to figure out code which has been moved from one file to another, but I am wondering how this feature is usable when doing conflict resolution in merges.</p>
  
  <p>Here is the scenario:</p>
  
  <p>I have two files <code>hello.cc</code> and <code>bye.cc</code> created. I start a branch <code>topic</code> and move some code from <code>hello.cc</code> to <code>bye.cc</code>. If I now do a <code>git blame -C bye.cc</code> I can see that this code originally came from <code>hello.cc</code> which is nice to know. However now I switch to the original branch without the moved content and change some code within the section in <code>hello.cc</code> that has been moved in the other commit. If I now do a <code>git merge topic</code> I get a conflict for <code>hello.cc</code>. However unless I use a diff3 style (which I usally do though), I can only see that this method has been removed from <code>hello.cc</code> in the other branch, but not that it has been changed afterwards. What would be nice would be to also get a conflict on <code>bye.cc</code> because it would be necessary to check if those changes from the other branch will have to be reapplied to the code. Is this somehow possible?</p>
  
  <p>I know I can manually figure out, that the code has been moved by doing a <code>git blame --reverse -C topic...</code>. However for one it took me quite a while to figure out this possibility and most other will probably not know about it. For second I am lazy and will probably just forget that the code might have been moved. Also I am not sure that this works when the code has been moved to more than one file.</p>
  
  <p>What would be your way to keep this situation as safe as possible?</p>
  
  <p><strong>Edit</strong>:</p>
  
  <p>I just found out that <code>git blame --reverse -C hello.cc $(git merge-base HEAD topic)..topic</code> also works to find out where the content moved. And if I do understand git correctly, this is probably faster, because it will not do a full search of the content in the full repository.</p>
  
  <p><strong>Edit</strong>:</p>
  
  <p>I uploaded the repository I am using for playing around to <a href="https://github.com/LiKao/Playground" rel="noreferrer">github</a> so you can try out the merge for yourself. The commit where I moved the function is in the topic branch. The commit where the same function get's changed in master at HEAD of branch <code>merge_here</code>. There is one additional commit in master in which I was playing around with some other merging techniques, which you should ignore for this question.</p>