Kaj Kandler
Kaj Kandler

Reputation: 318

git-pull: could not detach HEAD for Unicode filenames

I run this git pull command and it chokes on the Unicode file names

& git pull
From . 
  * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
error: The following untracked working tree files would be overwritten by checkout:
    test-sample-files/MByte/CJK-UTF8-MultiByte/樣品套裝/サンプル.java
    test-sample-files/MByte/CJK-UTF8-MultiByte/樣品套裝/의 견본을 뽑다.java
    test-sample-files/MByte/japanese/これはサンプルのテストであり、できるだけ早く修正する必要があります.java
    test-sample-files/MByte/japanese/サンプル.java
    test-sample-files/MByte/korean/의 견본을 뽑다.java
Please move or remove them before you can switch branches.
Aborting
could not detach HEAD

However a git status reports the working directory clean

$ git status
# On branch dev/experimental
# Your branch and 'master' have diverged,
# and have 3 and 96 different commit(s) each, respectively.
#
nothing to commit (working directory clean)

no "git add", or "git reset" or "rm ...*" does resolve the situation. Any help is much appreciated.

P.S.: I'm running "git version 1.7.5.4" on Mac OS X Leopard (10.5), which is the latest pre-build I could find for leopard.

Upvotes: 3

Views: 9372

Answers (2)

Kaj Kandler
Kaj Kandler

Reputation: 318

The cause for this is described in stack overflow already and a workaround to handle Mac OS X UTF-8 encoded file names with git! is described as well.

Upvotes: 1

CharlesB
CharlesB

Reputation: 90316

Your files are untracked in the current state of your working tree. That's why git add or git rm doesn't do anything.

Stash them with git stash save --untracked, they will be saved in a stash. After pull you can restore with git stash pop but you might have conflicts them since the pull will have checked theme out at a possible different content.

Since you're stuck with Git 1.7.5 stash doesn't know the --untracked option, so you can

  • move untracked files to a temp directory, and restore them:

     git ls-files --other --exclude-standard | xargs -t -I file  mv file untracked
    
  • Or add them with git add -u, and commit

Upvotes: 3

Related Questions