Git problems... when moving.

There is a good explanation of the problems people have because of gits lack of move support. This is Linus explaining this problem he has with git.

The problem is that git gets confused when you move code from one file to another, and change it at the same time. Since it uses code similarity to find moved code - changing the code at the same time that you move it confuses it's move detection code.

So the solution is a convention of making almost no code changes when moving a file. Delete the file, and create your new file with no changes, and merge - then make your code changes in the new file.

See the problem with git and move for more details.

Of course systems which don't use move detection by code similarity completely fail when people delete a file, and create a new file(eg. bzr).

So both git, and bzr fail when you forget to follow conventions. An ultimate system would do both - detect code moves automatically, and allow you to do explicit moves.

Update: Jay Parlar comments that you can do explicit moves with git. By using the git-mv tool.


Jay Parlar said…
How about git-mv to do explicit moves? I've not tried it yet (still relatively new to git), but it looks like it does what you want.

Popular posts from this blog

Is PostgreSQL good enough?

Experiments with new low latency PyPy garbage collector in a thread.

🐱‍🏍 — the first pygame 2 community game. Starting now! Are you in?