我正和一个朋友在一个iOS项目上工作,我们正在使用git进行版本控制,使用Xcode。我的朋友已经提交了更改,我在本地进行了更改。当我尝试提交更改时,我在Xcode中收到此错误:
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
当我试图拉动时,Xcode警告我失去了我的本地变化:
我们如何简单地合并这些变化?我之前使用过TFS,事情变得更加容易,我们已经检查了变化,并获得了最新信息,如果有任何冲突,我们可以解决它。我们不需要分支等,我们只需要保持代码同步。
如何尽可能简单地解决这个“死锁”?或者换句话说,在git中类似于“只是检入/合并/获取最新的TFS”? Xcode内置解决方案首选,没有终端。
更新:
如果我在终端输入git status
,这就是我得到的。
Cans-MacBook-Pro:myappname Can$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
You have unmerged paths.
(fix conflicts and run "git commit")
Changes to be committed:
modified: BigPostView.xib
modified: BigPostViewController.h
... (many others displayed here)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: myappname/Storyboard.storyboard
Cans-MacBook-Pro:myappname Can$
答案 0 :(得分:1)
您应始终能够提交更改,因为这是本地操作。只有当您尝试推送提交的更改时,才会收到错误。
为了推动您的提交,您必须先完成朋友的更改。