文章目录
  1. 1. FAQ
    1. 1.1. .pbxproj 冲突
  2. 2. 文档信息

0、创建代码库的方式有两种:0、新建工程时创建;1、把现有的工程复制到代码库下,再初始化代码库。

  0、新建工程时创建,勾选住 “Create Git repository on”

图片

打开存储目录,目录的结构为:

image

  1、新建的工程不勾选 “Create Git repository on”,目录应为:

image

将其复制到代码库下,切换到工程目录下进行初始化代码库 git init,使得工程目录为一个代码库。

1、进行版本控制管理


  0、添加远程代码库,在终端切换到工程目录下,执行:

1
$ git remote add origin SSH/HTTPS....git

  1、在工程目录下存在版本库的配置信息 .git/config 文件

1
$ cat .git/config   //可以查看版本库的相关配置信息

可以对单个文件进行 commit ,也可以对多个文件进行 commit

参考资料


1、How do you get git to always pull from a specific branch?

FAQ


.pbxproj 冲突


both modified: .xcodeproj/project.pbxproj
方法一:
在开发中当两个人用命令行同时往远程仓库上 push 代码时,我们可能上述情况,project.pbxproj 这个文件,是记录我们项目中文件结构的,当我们每建一次文件时,该文件都会发生改变。
解决方法:
在命令行中,cd 到项目的 .git 目录下,vim .gitattributes 在文件中添加 `
.pbxproj binary merge=union` 这行文字,即可解决此问题。

FQA:Fixing the conflict resolution of .pbxproj files with GIT and XCode

1、Go to the root directory of your git repository, where the .git directory is,
2、edit or create the .gitattributes file,
3、add the following line: *.pbxproj binary merge=union

1
2
3
# Telling GIT that Xcode pbxproj remote and local files
# should be merged using union of differences
*.pbxproj binary merge=union

方法二:
人工编辑 project.pbxproj 这个文件,根据实际情况去除冲突符 或 里面的代码。

方法三(待验证):
在终端运行 ./file.sh 文件,删除 *.xcodeproj 文件中的冲突提示标识

1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh

projectfile=`find -d . -name 'project.pbxproj'`
projectdir=`echo *.xcodeproj`
projectfile="${projectdir}/project.pbxproj"
tempfile="${projectdir}/project.pbxproj.out"
savefile="${projectdir}/project.pbxproj.mergesave"

cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile
cp $projectfile $savefile
mv $tempfile $projectfile
mv $savefile

文档信息


  • 版权声明:自由转载-保持署名-非商用-非衍生 ( CC BY-NC-ND 4.0 )
文章目录
  1. 1. FAQ
    1. 1.1. .pbxproj 冲突
  2. 2. 文档信息