Search code examples
gitunicodemsysgit

msysgit Unicode support: I did a mess while migrating from previous Git versions


I have a repo with accented letters in paths and filenames. I upgraded to msysgit 1.8.0-preview and kept working on one of the branches (let's call it recent), committing and pushing as needed. When I realized that my repo needed a migration because of the Unicode support introduced with v1.7.10, I followed the instructions found here.

I could migrate all the 'inactive' branches and I can checkout between them no problem. However I cannot checkout to recentanymore. Git reports:

error: The following untracked working tree file would be overwritten by checkout:

<list of files with accented letters>

Please move or remove them before you can switch branches

There are no untracked files according to git status. The only way I can get to recentis by setting it as the main branch on BitBucket, and clone the repo. When I am on that branch git status reports no untracked files, and everything up to date. The migration instructions won't work there (again no untracked files to work with) and, again, if I switch to another branch I cannot switch back.

I'm kinda lost at this point, would any brave soul help me out? I'm the only one pushing to the remote repo. Thanks!


Solution

  • Here is the deal: you have some file, let's call it a.txt, which is in your working directory but it does NOT exist on your main branch. You probably have it listed in .gitignore so it doesn't show up when you run git status. The recent branch probably has a file named a.txt in it. When you try to check out to the recent branch, git wants to put a file called a.txt in your working directory but it can't because you already happen to have one there.

    Solution: Pay attention to the error message git is giving you! Move the files in that list to some totally different directory so they don't get lost, and then you should be able to check out the recent branch just fine. By the way, ls is generally a more reliable way to see if a file exists than git status.