I’ve moved a file manually and then I’ve modified it. According to Git, it is a new file and a removed file. Is there any way to force Git into treating it as a file move?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Git will automatically detect the move/rename if your modification is not too severe.
Just
git addthe new file, andgit rmthe old file.git statuswill then show whether it has detected the rename.additionally, for moves around directories, you may need to:
git add -A .git statusto verify that the "new file" is now a "renamed" fileIf git status still shows "new file" and not "renamed" you need to follow Hank Gay’s advice and do the move and modify in two separate commits.