git常见问题

git合并常见问题

合并失败后报错:

1
2
3
git add .
error: unable to index file OCARKitTest/ThirdParty/CocoaAsyncSocket
fatal: updating files failed

解决方法:

1
2
3
4
$ git rm --cached -r OCARKitTest/ThirdParty/
$ git add .
$ git commit -m ""
$ git push

摆错二

1
2
3
4
5
6
git checkout devel
error: The following untracked working tree files would be overwritten by checkout:
OCARKitTest/OCARKitTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
OCARKitTest/OCARKitTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Please move or remove them before you switch branches.
Aborting

通过错误提示可知,是由于一些untracked working tree files引起的问题。所以只要解决了这些untracked的文件就能解决这个问题。

解决方法:

1
2
3
4
git clean  -d  -fx .
git add .
git commit -m ""
git push