1. git push 遇到 master branch has no upstream branch
原因:没有将本地的分支与远程仓库的分支进行关联。
解决:1. git push --set-upstream origin master
2. git push -u origin master
2. git pull 遇到 There is no tracking information for the current branch.
原因:当前分支未找到跟踪
解决:git pull origin master
3. git pull origin master 遇到 refusing to merge unrelated histories
原因:拒绝合并不相关的历史。这是因为两个分支没有取得关系,多数为本地直接关联远程库而不是clone下来
解决:git pull origin master --allow-unrelated-histories
4. git pull 遇到 Automatic merge failed; fix conflicts and then commit the result.
原因:多人协作修改同一文件导致代码冲突。
解决:如果是需要远程的代码 $:git reset --hard origin
需要本地的代码,本地查看冲突的部分,处理完成后,重新 add 并执行上传流程
5. iOS git提交时忽略更新的UserInterfaceState.xcuserstate文件
git rm --cached xxx.xcworkspace/xcuserdata/xxx.xcuserdatad/UserInterfaceState.xcuserstate
git commit -m"remove UserInterfaceState.xcuserstate"
git push
网友评论