When I use git reset --mixed on a branch where I used git mv, the renames are replaced by delete and recreate.
Is there a way to avoid that?
When I use git reset --mixed on a branch where I used git mv, the renames are replaced by delete and recreate.
Is there a way to avoid that?
Try using soft instead of mixed.
git reset --soft <commit>
git commit -m "Preserve renames"
It moves the branch pointer to a specific commit without modifying the staging area or the working directory. This means that it keeps the changes you made, including renames, in the staging area.
In git, there is no difference between "rename" and "deleted + added".
If you look more closely at what happened after your reset, you should see that git status mentions the deletion of a tracked file and the presence of an untracked file.
If you know of one individual rename and run :
git add <old_name> <new_name>
git status show now indicate that a rename is staged.