Rearranging projects in Git and Unity

Rearranging projects in Git and Unity

I'm attempting to rearrange a Unity project that is under source control. Two problems:

In order to maintain the relationships between assets, I need to use Unity's API or interface. But when I move something that way, git loses track of them.
In order to maintain git tracking, I need to use git commands. But when I move them that way, Unity loses track of how they're related.

Is there an easy way for me to tell one what the other is doing?


Answer 1:

I would always use the unity tools to modify unity projects, since in the end i want a working game and not just a nice git history.

From my experience git is pretty smart about understanding your moves and renames from the delete/add pairs of nearly identical files, but these only show up once you stage your changes with git add. Also make sure no one else works on the repository while you move things are, you might get nasty conflicts otherwise.

The good thing about using git is you can just go ahead and try a small refactoring in unity to see how git would manage it. If you don’t like the result, rollback to the last commit.