1

I have a file in Git called 100_Test_Customer_Team_abc.txt which has been pushed to the remote repository. I made a mistake in the name - the team is supposed to be in capital letters, so I want to rename it to 100_Test_Customer_Team_ABC.txt.

I have used:

git mv 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt

But I get the following error:

fatal: destination exists

How can I rename it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
gpullen
  • 1,093
  • 2
  • 14
  • 28

2 Answers2

2

You could try this solution:

 git mv --force 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt
teoreda
  • 2,392
  • 1
  • 21
  • 28
0

Move it using the mv command:

mv 100_Test_Customer_Team_abc.txt 100_Test_Customer_Team_ABC.txt

Since you are using Windows, just you can simply rename the file via Windows Explorer.

Then add all changes as tracked changes: git add -A. You will see then that Git tracks the deleted/added as a renamed in git status

Now you can simply git commit -m 'Renamed file' and push to remote.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131