Reputation: 14239
I have a committed repo, where the workflow is as follows:
Edit on remote machine1 which does not have git.
~/project/files+folders
After editing I rsync it to machine2, where it is merged with the repository.
~/project/.git
~/project/files+folders
On machine2 I then use git do add/commit the files. File renames are performed on machine1 via mv
, and rsynced down to machine2. This is the reason why I can't use git-mv, because machine1 has no git and maybe it wouldn't even matter if it has because no commits are being made on machine1.
My issue is that a git status
on machine2 shows that the renamed file is first deleted and then re-added, not renamed. The content is unchanged. Even when I rename it directly on machine2, it is also not recognized. Only when I use git mv
.
This would mean that I need to rename all the files via git mv
on machine2 and via mv
on machine1, so that rsync continues to behave as expected (haven't tested this, but I assume it would not sync the renamed files since they are identical on both machines).
What is causing git to not detect the file rename via mv
? Is there a flag which I can set so that this rename would get noticed?
One thing, I am assuming that no rename will get committed, because git status
shows it as a deleted
and added
operation, while normally I see a renamed
in git status
.
A rename would look like this mv module_stuff_information.py module_core.py
Upvotes: 1
Views: 621
Reputation: 706
You have to add both changes (deletion and addition) to the index in order for git to recognize it as a rename. So git add -A
, for example, should help.
Upvotes: 1