git的常规使用方法(iOS版)
来源:互联网 发布:河南云和软件科技 编辑:程序博客网 时间:2024/05/16 11:45
好久没有接受新项目了,今天收到一个任务要开发一个新的appstore项目,由于太久没有开发,git命令已经略显生疏,所以今天复习一下。
首先,申请开发证书,这些就不说了,我们只说git相关的操作。
首先,申请开发证书,这些就不说了,我们只说git相关的操作。
第一步 创建git仓库
git clone git@gitlab.com:zhikang_iOS/CloudLive.gitcd CloudLivetouch README.mdgit add README.mdgit commit -m "add README"git push -u origin masterExisting foldercd existing_foldergit initgit remote add origin git@gitlab.com:zhikang_iOS/CloudLive.gitgit add .git commit -m "Initial commit"git push -u origin masterExisting Git repositorycd existing_repogit remote rename origin old-origingit remote add origin git@gitlab.com:zhikang_iOS/CloudLive.gitgit push -u origin --allgit push -u origin --tags
第二步(实例操作)
kent-net:CloudLive_iOS kentj$ touch .gitignore 创建ignore文件,将下面代码粘贴到ignore文件中(仅iOS使用)/************************************************* # Xcode.DS_Store*/build/* *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata profile *.moved-aside DerivedData .idea/ *.hmap *.xccheckout *.xcworkspace !default.xcworkspace #CocoaPods Pods !Podfile !Podfile.lock/*************************************************kent-net:CloudLive_iOS kentj$ git status 看下git状态如下?Your branch is up-to-date with 'origin/master'.Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: .DS_Store modified: CloudLive/.DS_Store modified: CloudLive/CloudLive.xcodeproj/project.xcworkspace/xcuserdata/kentj.xcuserdatad/UserInterfaceState.xcuserstateUntracked files: (use "git add <file>..." to include in what will be committed) .gitignoreno changes added to commit (use "git add" and/or "git commit -a") 那我们怎么解决上述问题呢?第三步 解决.DS_Store的问题
kent-net:CloudLive_iOS kentj$ find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch rm '.DS_Store' rm 'CloudLive/.DS_Store' rm 'CloudLive/CloudLive/.DS_Store' rm 'CloudLive/CloudLive/Image/.DS_Store' rm 'CloudLive/CloudLive/Image/Mine/.DS_Store' rm 'CloudLive/CloudLive/Module/.DS_Store' kent-net:CloudLive_iOS kentj$ git status On branch master Your branch is up-to-date with 'origin/master'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: .DS_Store deleted: CloudLive/.DS_Store deleted: CloudLive/CloudLive/.DS_Store deleted: CloudLive/CloudLive/Image/.DS_Store deleted: CloudLive/CloudLive/Image/Mine/.DS_Store deleted: CloudLive/CloudLive/Module/.DS_Store Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: CloudLive/CloudLive.xcodeproj/project.xcworkspace/xcuserdata/kentj.xcuserdatad/UserInterfaceState.xcuserstate Untracked files: (use "git add <file>..." to include in what will be committed) .gitignore kent-net:CloudLive_iOS kentj$ git add --all kent-net:CloudLive_iOS kentj$ git commit -m '.DS_Store banished!' [master d6b40d5] .DS_Store banished! 8 files changed, 28 insertions(+) delete mode 100644 .DS_Store create mode 100644 .gitignore delete mode 100644 CloudLive/.DS_Store delete mode 100644 CloudLive/CloudLive/.DS_Store delete mode 100644 CloudLive/CloudLive/Image/.DS_Store delete mode 100644 CloudLive/CloudLive/Image/Mine/.DS_Store delete mode 100644 CloudLive/CloudLive/Module/.DS_Store kent-net:CloudLive_iOS kentj$ git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working tree clean第四步 提交修改,到这基本就大功告成了
kent-net:CloudLive_iOS kentj$ git pushCounting objects: 13, done.Delta compression using up to 4 threads.Compressing objects: 100% (12/12), done.Writing objects: 100% (13/13), 1.31 KiB | 669.00 KiB/s, done.Total 13 (delta 2), reused 0 (delta 0)To gitlab.com:zhikang_iOS/CloudLive.git2f7a7dc..d6b40d5 master -> m
第五步 那我们创建一个类来看下
kent-net:CloudLive_iOS kentj$ git statusOn branch masterYour branch is ahead of 'origin/master' by 2 commits.(use "git push" to publish your local commits)Changes to be committed:(use "git reset HEAD <file>..." to unstage)new file: CloudLive/CloudLive/FFViewController.hnew file: CloudLive/CloudLive/FFViewController.mnew file: CloudLive/CloudLive/FFViewController.xibChanges not staged for commit:(use "git add <file>..." to update what will be committed)(use "git checkout -- <file>..." to discard changes in working directory)modified: CloudLive/CloudLive.xcodeproj/project.pbxproj
大家已经看到,不会再出现除了项目代码相关意外的文件了
阅读全文
0 0
- git的常规使用方法(iOS版)
- iOS Git的使用方法(sourcetree)
- git 的常规使用
- GIT 的常规操作
- smarty常规函数的使用方法
- git的常规使用命令
- Git的常规操作-资料篇
- Git的常规设置(服务器的搭建)
- Dialog的使用方法:常规和自定义
- Android Notification的常规使用方法笔记
- Android常规控件的基本使用方法
- git代码提交的一些常规流程
- GIT 的使用方法详解
- git 代理的使用方法
- GIT 的使用方法详解
- GIT 的使用方法详解
- GIT 的使用方法详解
- git的使用方法
- 做好自己的事情同时,新开项目,新产品
- Java四种引用包括强引用,软引用,弱引用,虚引用。
- 实验十 LL(1)分析表的构造
- 博客启动
- POJ 3279 Fliptile(开关问题)
- git的常规使用方法(iOS版)
- 大型网站架构演化
- solr7搭建搜索服务
- 【C语言】求取第n个斐波那契数的时间复杂度、空间复杂度分析,用三种方式实现(普通递归,循环,优化递归)
- mybatis foreach 出现 there is no getter for property named '__frch_item_0' in 'class
- python-set()集合操作(创建、添加、删除、交集、并集、差集、对称差集)
- 幸运大奖
- express连接数据库、上传图片总结
- mysql 5.7 Transparent PageIO Compression