Xcode:工作副本有未提交的更改

时间:2015-08-01 14:09:06

标签: xcode git

当尝试在Xcode 7 beta 3或6.4中切换分支时,我得到“工作副本有未提交的更改”。如果我提交或放弃所有更改并再试一次,我会得到相同的结果。

更新

所以现在我无法检查另一个分支,无论我尝试什么:

MacBook-Air:Åka Strax andreas$ git reset --hard

HEAD is now at 9190d8c omstrukturerat typer

MacBook-Air:Åka Strax andreas$ git status

HEAD detached at 9190d8c
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   "A\314\212ka Strax.xcodeproj/project.pbxproj"

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    "N\303\244rliggandeH\303\245llplatser.swift"

no changes added to commit (use "git add" and/or "git commit -a")

MacBook-Air:Åka Strax andreas$ git checkout master

error: Your local changes to the following files would be overwritten by checkout:
    Åka Strax.xcodeproj/project.pbxproj
Please, commit your changes or stash them before you can switch branches.
Aborting

MacBook-Air:Åka Strax andreas$ git rm --cached "Åka Strax.xcodeproj/project.pbxproj"

rm 'Åka Strax.xcodeproj/project.pbxproj'

MacBook-Air:Åka Strax andreas$ git status

HEAD detached at 9190d8c
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    deleted:    "\303\205ka Strax.xcodeproj/project.pbxproj"

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   "A\314\212ka Strax.xcodeproj/project.pbxproj"

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    "N\303\244rliggandeH\303\245llplatser.swift"
    "\303\205ka Strax.xcodeproj/project.pbxproj"

初步“解决”并发症:

这里是git status和SO的一些命令(按顺序)回答类似的问题:

MacBook-Air:Åka Strax andreas$ git status

On branch swift_2.0-tester
Your branch is ahead of 'origin/swift_2.0-tester' by 1 commit.
  (use "git push" to publish your local commits)
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    "N\303\244rliggandeH\303\245llplatser.swift"
    "\303\205ka Strax.xcodeproj/project.xcworkspace/xcshareddata/"
    "\303\205ka Strax.xcodeproj/xcuserdata/"

nothing added to commit but untracked files present (use "git add" to track)

MacBook-Air:Åka Strax andreas$ git reset --hard HEAD

HEAD is now at a69fdbe

MacBook-Air:Åka Strax andreas$ git status

On branch swift_2.0-tester
Your branch is ahead of 'origin/swift_2.0-tester' by 1 commit.
  (use "git push" to publish your local commits)
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    "N\303\244rliggandeH\303\245llplatser.swift"
    "\303\205ka Strax.xcodeproj/project.xcworkspace/xcshareddata/"
    "\303\205ka Strax.xcodeproj/xcuserdata/"

nothing added to commit but untracked files present (use "git add" to track)

MacBook-Air:Åka Strax andreas$ git add "N\303\244rliggandeH\303\245llplatser.swift"

fatal: pathspec 'N\303\244rliggandeH\303\245llplatser.swift' did not match any files

MacBook-Air:Åka Strax andreas$ git rm --cached "N\303\244rliggandeH\303\245llplatser.swift"

fatal: pathspec 'N\303\244rliggandeH\303\245llplatser.swift' did not match any files

老实说,我不明白git告诉我什么。

2 个答案:

答案 0 :(得分:2)

默认情况下,git status的路径输出被转义,使用操作系统提供的文件名(Linux上为ls .),在这种情况下,您可以尝试git add NärliggandeHållplatser.swift

有关详细信息,请参阅core.quotePath at https://www.kernel.org/pub/software/scm/git/docs/git-config.html

答案 1 :(得分:0)

似乎Git在某些文件系统(如HFS +)上的文件名方面基本上被打破了。 Git看起来很天真,期望所有文件系统对文件标识符/文件名具有相同的要求。也许OSX在创建文件时不会将Git设为实际文件名,尽管这听起来有些牵强。

我只在OS X上使用这个repo,但我似乎仍然遇到文件名编码问题。

要解决这个问题,我只能在我的文件名中使用ASCII。感觉就像回到过去一样。