首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xcode:工作副本有未提交的更改

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

Stack Overflow用户
提问于 2015-08-01 14:09:05
回答 2查看 3.6K关注 0票数 2

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

更新:

所以现在我不能再查另一家分行了,不管我怎么做:

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

代码语言:javascript
复制
HEAD is now at 9190d8c omstrukturerat typer

MacBook-Air:Åka Strax andreas$ git status

代码语言:javascript
复制
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

代码语言:javascript
复制
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"

代码语言:javascript
复制
rm 'Åka Strax.xcodeproj/project.pbxproj'

MacBook-Air:Åka Strax andreas$ git status

代码语言:javascript
复制
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和一些命令(按顺序排列),它们回答了类似的问题:

MacBook-Air:Åka Strax andreas$ git status

代码语言:javascript
复制
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

代码语言:javascript
复制
HEAD is now at a69fdbe

MacBook-Air:Åka Strax andreas$ git status

代码语言:javascript
复制
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"

代码语言:javascript
复制
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"

代码语言:javascript
复制
fatal: pathspec 'N\303\244rliggandeH\303\245llplatser.swift' did not match any files

我真的不明白git在告诉我什么。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-08-02 18:43:26

从某些文件系统(如HFS+)上的文件名来看,Git似乎从根本上被打破了。Git似乎天真地期望所有文件系统对文件标识符/文件名都有相同的要求。在创建文件时,OSX可能不会将Git的实际文件名交给Git,尽管这听起来有些牵强。

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

为了解决这个问题,我被迫只在我的文件名中使用ASCII。感觉就像回到过去。

票数 0
EN

Stack Overflow用户

发布于 2015-08-01 19:00:11

默认情况下,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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31762768

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档