首页 > 其他分享 >[IOS]如何结合XCODE使用git以及异常处理

[IOS]如何结合XCODE使用git以及异常处理

时间:2022-10-10 21:39:45浏览次数:51  
标签:git -- XCODE IOS branch commit xcuserstate gitignore


1.控制台cd到项目目录下,输入命令:git init

 

2.在git server创建xxx/project_name.git,输入命令:git --bare init

 

3.本地控制台:



git add .
git commit -m "first Commit"
git remote add origin [email protected]:tingkongwanli/git.git
git push -u origin master



 

4.这样就创建成功了,可以在xcode添加git,然后checkout下来(第一次),以后有更新从master pull下来最新代码

 

5.new a branch,然后可以写你自己部分的代码了。写完后可以commit(local)

 注释:merge from branch----从其他地方合并到我的branch

            merge into branch----把我的代码合并到其他branch

 

6.push:用于最终发送到server。切换回master,merge from branch,把最新修改的branch代码合并到master上,最后push上server上面

 

参考:http://www.jianshu.com/p/103d74b69a13

 

注意出现Git ignore UserInterfaceState.xcuserstate问题:

1.建立.gitignore,作用是让git忽略自定义规则;

 

2.项目目录下,新建.gitignore



touch .gitignore
open .gitignore



 

3..gitignore中输入


*.xcuserstate  
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate
.DS_Store

 

4.在命令行输入:

$ git rm --cached path/to/.DS_Store
$ git rm --cached *.xcuserstate

提交:
$ git add .gitignore
$ git commit -m "Remove and ignore .xcuserstate and .DS_Store files."

 

这时候在xcode进行merger,会提示commit:

控制台输入命令:



git rm --cached ProjectFolder.xcodeproj/project.xcworkspace/xcuserdata/myUserName.xcuserdatad/UserInterfaceState.xcuserstate
git commit -m "Removed file that shouldn't be tracked"



 再merge,成功

 

注意:要切换到出问题的branch下才能找到UserInterfaceState.xcuserstate,要不会报错

标签:git,--,XCODE,IOS,branch,commit,xcuserstate,gitignore
From: https://blog.51cto.com/u_15740686/5745306

相关文章

  • IOS Push notification 摘要
    2.​​registerForRemoteNotificationTypes: is not supported ​​​​in​​​ ​​iOS 8.0 and later.报错​​解决办法可参考:http://stackoverflow.com/questi......
  • Linux磁盘相关工具 -- iostat
    iostat主要用于监控系统设备的IO负载情况,根据这个可以看出当前系统的写入量和读取量,CPU负载和磁盘负载。iostat主要用于输出磁盘IO和CPU统计信息。1. iostat用法:iostat......
  • github分支
    title:Github分支excerpt:转载自TsumugiWenders大佬~tags:[git,github,gitee]categories:[学习,git]index_img:https://picture-store-repository.oss-cn-ha......
  • git入门
    title:git入门excerpt:转载自TsumugiWenders大佬~tags:[git,github,gitee]categories:[学习,git]index_img:https://picture-store-repository.oss-cn-hangz......
  • github标签管理
    title:github标签管理excerpt:转载自TsumugiWenders大佬~tags:[git,github,gitee]categories:[学习,git]index_img:https://picture-store-repository.oss-c......
  • git命令
    title:Git命令excerpt:转载自TsumugiWenders大佬~tags:[git,github,gitee]categories:[学习,git]index_img:https://picture-store-repository.oss-cn-hangz......
  • axios完整配置请求数据
    <scripttype="module">importaxiosfrom'./lib/axios.min.js'//axios完整配置请求语法:axios(config)axios({url:'/admin/detail',//url会拼接在......
  • git实战
    安装:https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git#表示当前文件中所有没被管理起来的文件(标红的)红变绿就是把没管理起来的文件管理起......
  • gitlap上面fork了别人的仓库,当源仓库有更新了,自己的本地仓库和自己的远程仓库怎么更新
      如图:自己的远程仓库是origin,fork的源仓库命名为source。当source仓库有发生更新时,怎么推送到我们的origin?方法如下:第1步:gitfetchsourcedevelop//从远程......
  • GitHub看不懂,下载慢?这两个油猴脚本可以解决
    GitHub是全球最出名的开源及私有软件项目托管平台,无论是专业的技术人士还是其他的技术爱好者都会时不时的去逛逛。对于开发者来说可以在上面提交自己的项目,和其他人一起分享......