To rename a file and track the change in Git, you can use the git mv command. The syntax is as follows:
git mv <old_filename> <new_filename>
For example, if you want to rename a file from oldfile.txt to newfile.txt, you would use:
git mv oldfile.txt newfile.txt
After executing this command, Git will recognize the rename operation, and you can then commit the change with:
git commit -m "Renamed oldfile.txt to newfile.txt"
This will record the change in the version history of your Git repository.