我正在尝试在git中切换分支但我收到此错误消息:
error: you need to resolve your current index first
Run Code Online (Sandbox Code Playgroud)
我在xcode4下使用git
git status
# On branch DateCode
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both modified: Whereami.xcodeproj/project.xcworkspace/xcuserdatauser.xcuserdatad/UserInterfaceState.xcuserstate
#
no changes added to commit (use "git add" and/or "git commit -a")
Frappuccinos-MacBook-Pro:whereami
Run Code Online (Sandbox Code Playgroud)
jit*_*hit 91
如果您不想要git status中列出的任何合并,请尝试此操作:
git reset --merge
Run Code Online (Sandbox Code Playgroud)
这将重置索引并更新工作树是之间的不同的文件<commit>和HEAD,但保留那些(有还没有被添加修改IE)的索引和工作树之间的不同.
如果<commit>索引之间的文件与索引之间存在不同的更改,则会中止重置.
更多相关信息 - https://git-scm.com/docs/git-reset
Mar*_*air 53
您最终both modified的输出git status是否有通过合并产生的冲突.在您解决了这些冲突之前,git不允许您更改分支.如果您编辑该文件,您应该会在其中看到一些冲突标记 - 这是一个解决git手册中的冲突的指南.(由于kernel.org目前已关闭,您可以在此处找到该指南.)
或者,如果您认为合并是一个错误,您可以通过以下方式撤消它: git reset --merge
jya*_*apx 17
如果您不关心git所说的未完成的更改,那么您可以进行强制检查.
git checkout -f {{insert your branch name here}}
你可以用HEAD重置你的分支
git reset --hard branch_name
Run Code Online (Sandbox Code Playgroud)
然后获取分支并删除不在本地远程的分支,
git fetch -p
Run Code Online (Sandbox Code Playgroud)
小智 5
当我从远程更新新文件时,我收到了这条消息,而索引也没有了.试图修复索引,但通过Xcode 4.5,GitHub.app(103)和GitX.app(0.7.1)解析失败.所以,我这样做了:
git commit -a -m "your commit message here"
Run Code Online (Sandbox Code Playgroud)
它绕过了git索引.
两篇帮助我了解Git和Xcode的博客文章是:
| 归档时间: |
|
| 查看次数: |
94694 次 |
| 最近记录: |