I'm developing a piece of software which is built on top of an open source project but contains some proprietary changes. Recently, there has been a big update to the open source project which has moved a bunch of files. For example:
app/models/my_model.rb --> app/models/namespace/my_namespaced_model.rb
There are a lot of files which were moved, and some of them have a lot of changes. So git is not merging the files, but is just saying that the old files have been "deleted by them" and marking it as a merge conflict. The thing is, if there were simply a few less changes so that git could realize that the file had been moved, rather than thinking it was deleted and a new one was created, I think it would sort out most of the changes easily. As it stands, it looks like I need to go through and make all the old changes to the new files by hand.
So my question is, is there any way to force git to realize that a file has been moved when it can't figure it out automatically?
The recursive strategy that git merge uses by default has a "rename-threshold" option that you may be able to change to help. You may have to experiment to find the best setting.
git merge -X rename-threshold=70 mybranch
The setting has the same effect as in
git diff -M and is described in the
git diff manpage.
-X ...(with a space) - torek 2012-04-04 18:55