为什么我不能切换分支? [英] Why can I not switch branches?
问题描述
错误:您需要在git中切换分支,但我收到以下错误消息:首先解析你的当前索引
我在xcode4下使用git
git status
#分支日期代码
#未合并路径:
#(使用git reset HEAD< file> .. 。to unstage)
#(使用git add / rm< file> ...来标记分辨率)
#
#都被修改:Whereami.xcodeproj / project。 xcworkspace / xcuserdatauser.xcuserdatad / UserInterfaceState.xcuserstate
#
没有更改添加到提交(使用git add和/或git commit -a)
Frappuccinos-MacBook-Pro:whereami
如果您不想要任何合并列入git状态:
git reset --merge
这会重置索引并更新工作树中不同的文件een < commit>
和 HEAD
,但是保留索引和工作树之间不同的那些。如果一个文件在< commit>
和之间不同,索引已经暂停了更改 - 重置已中止。
更多相关信息 - https://git-scm.com/docs/git-reset
I'm trying to switch branches in git but I'm getting this error message:
error: you need to resolve your current index first
I'm using git under xcode4
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
Try this if you don't want any of the merges listed in git status:
git reset --merge
This resets the index and updates the files in the working tree that are different between <commit>
and HEAD
, but keeps those which are different between the index and working tree (i.e. which have changes which have not been added).
If a file that is different between <commit>
and the index has unstaged changes -- reset is aborted.
More about this - https://git-scm.com/docs/git-reset
这篇关于为什么我不能切换分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!