SVN under Mac submits xcode project code files that need to be filtered

SVN client tool I use cornerstone

The following two paragraphs need to be set in .subversion-->config

1. Find the following line

### Section for configuring automatic properties.
[auto-props]

2. Add in the back

*.mode* = svn:mime-type=text/X-xcode
*.pbxuser = svn:mime-type=text/X-xcode
*.perspective* = svn:mime-type=text/X-xcode
*.pbxproj = svn:mime-type=text/X-xcode


3. Find the following line

global-ignores =

After the = sign is the suffix name of the file that needs to be ignored. If you are submitting an xcode project, add it after

.DS_Store build *~.nib *.pbxuser *.mode *.perspective* 
  xcuserdata xcshareddata Pods *.xcuserstate *.pbxuser Podfile.lock

1. Files that can be ignored in iOS development

1. project.pbxproj: The project file, which needs to be submitted to svn.

2. project.xcworkspace: The space can put multiple projects and other files together. A project can also belong to multiple workspaces. Need to commit svn.

3. The user.pbxuser file The Xcode project creates a user.pbxuser file for each user who uses the project, which stores the user's preferences for the project, such as the location and size of Xcode, file bookmarks, and more. It can be seen that this file is for a certain user, it can be said to be private, and it has nothing to do with the whole project, so it generally does not need to be synchronized.

4. The user.mode1v3 and user.mode2v3 files are also user-related files, similar to user.pbxuser, which store user-specific project settings, such as the state and structure of the window in Xcode, breakpoints, and so on. Therefore synchronization is also not required.

5. xcuserdata directory/xcshareddata directory: Like the above two, it is also a user-related file, including user state, folder status, and the last opened file. Generally, synchronization is not required. The exception is that this directory also contains scheme-related content. If a specific scheme needs to be synchronized in the project, at this time, you need to check the Share box in the Edit Scheme, and then submit the newly generated xcshareddata directory.

.xccheckout: This file is in the xcworkspace directory. The .xccheckout file contains data about what repo is used in the workspace. According to the instructions, its rules are similar to those of xcworkspace: if you haven't used it, or you just use the workspace simply, you don't need to synchronize; if you use the workspace deeply, you need to synchronize.

2. Cornerstone ignores unnecessary files

Cornerstone --> Preference --> Subversion --> Global ignores, remove "use default global ignores".

Cornerstone ignores unnecessary files

3. Ignore files with the command line

To set to ignore the xcuserdata directory, you need:

  1. cd to the *.xcodeproj directory
    cd /Xcode_Project/Qzone-for-iPhone_WorkingCopy/iphone_qzone_proj/trunk/src/Libraries/blur/blur.xcodeproj

  2. 执行:
    svn propset svn:ignore xcuserdata .

  3. 退到工程根目录
    cd /Xcode_Project/Qzone-for-iPhone_WorkingCopy/iphone_qzone_proj/trunk/src/

  4. svn st
    M Libraries/blur/blur.xcodeproj

  5. svn ci

搞定。


与双系统无关。在Mac OS上会存在。

DS_Store 是用来存储这个文件夹的显示属性的:比如文件图标的摆放位置。删除以后的副作用就是这些信息的失去。(当然,这点副作用其实不是太大)

需要注意一点:project.pbxproj这个文件是用来记录工程目录结构的,例如你加两个类,拖动一个类的位置,这个文件都会有变化,在合作开发过程中,最好不要忽略这个文件,但需要跟伙伴提前约定好,每次需要更改工程目录的时候,需要先更新,再增加或修改类,再提交,最好沟通一下,因为工程大了,这个文件要是起冲突了,就不好改了,会导致工程无法打开。


(补充)忽略已经加入SVN版本控制的文件(夹)

上面的方法只适用于还未添加进版本控制的文件,如果是已经添加进版本控制的文件需要先将其从版本控制中删除才会生效

删除文件(以UserInterfaceState.xcuserstate为例,这里已经进入UserInterfaceState.xcuserstate目录下,也可替换为文件的绝对路径)

svn rm --force UserInterfaceState.xcuserstate
svn commit -m "忽略该死的UserInterfaceState.xcuserstate"



一、iOS开发中可以忽略的文件

1、project.pbxproj:项目文件,需要提交svn。

2、project.xcworkspace:空间可以将多个project和其它文件放到一起。一个project也可以属于多个workspace。需要提交svn。

3、user.pbxuser文件Xcode项目为每一个使用这个项目的用户创建一个user.pbxuser文件,存储了此用户对项目的偏好设置,如Xcode的位置和大小、文件书签等。可以看到这个文件是针对某个用户的,可以说是私人性质的,跟整个项目没有太大关系,所以一般不需要同步。

4、user.mode1v3和user.mode2v3文件这个也是用户相关的文件,和user.pbxuser差不多,存储某用户特定的项目设置,比如Xcode中window的状态和结构,断点等等。因此也不需要同步。

5、xcuserdata目录/xcshareddata目录 :和上面两种一样,也是用户相关的文件,包含user state,folders的状态,最后打开的文件等。 一般来说是不需要同步的。例外是,这个目录里也包含了scheme相关的内容。如果项目里需要同步特定的scheme,这时候,需要在Edit Scheme里,勾选Share框,然后把新生成的xcshareddata目录提交上去。

.xccheckout:这个文件在xcworkspace目录里。.xccheckout文件包含了关于workspace中用到了什么repo的数据。根据说明,它的规则和xcworkspace差不多:如果没用过,或者只是简单使用workspace,不需要同步;如果深入使用workspace,则需要同步。

二、Cornerstone忽略不必要的文件

Cornerstone——>Preference——>Subversion——>Global ignores中添加,去掉“use default global ignores”即可。

Cornerstone忽略不必要的文件

三、用命令行忽略文件

若要设置忽略xcuserdata目录,需要:

  1. cd到*.xcodeproj目录下面
    cd /Xcode_Project/Qzone-for-iPhone_WorkingCopy/iphone_qzone_proj/trunk/src/Libraries/blur/blur.xcodeproj

  2. 执行:
    svn propset svn:ignore xcuserdata .

  3. 退到工程根目录
    cd /Xcode_Project/Qzone-for-iPhone_WorkingCopy/iphone_qzone_proj/trunk/src/

  4. svn st
    M Libraries/blur/blur.xcodeproj

  5. svn ci

搞定。


一、iOS开发中可以忽略的文件

1、project.pbxproj:项目文件,需要提交svn。

2、project.xcworkspace:空间可以将多个project和其它文件放到一起。一个project也可以属于多个workspace。需要提交svn。

3、user.pbxuser文件Xcode项目为每一个使用这个项目的用户创建一个user.pbxuser文件,存储了此用户对项目的偏好设置,如Xcode的位置和大小、文件书签等。可以看到这个文件是针对某个用户的,可以说是私人性质的,跟整个项目没有太大关系,所以一般不需要同步。

4、user.mode1v3和user.mode2v3文件这个也是用户相关的文件,和user.pbxuser差不多,存储某用户特定的项目设置,比如Xcode中window的状态和结构,断点等等。因此也不需要同步。

5、xcuserdata目录/xcshareddata目录 :和上面两种一样,也是用户相关的文件,包含user state,folders的状态,最后打开的文件等。 一般来说是不需要同步的。例外是,这个目录里也包含了scheme相关的内容。如果项目里需要同步特定的scheme,这时候,需要在Edit Scheme里,勾选Share框,然后把新生成的xcshareddata目录提交上去。

.xccheckout:这个文件在xcworkspace目录里。.xccheckout文件包含了关于workspace中用到了什么repo的数据。根据说明,它的规则和xcworkspace差不多:如果没用过,或者只是简单使用workspace,不需要同步;如果深入使用workspace,则需要同步。

二、Cornerstone忽略不必要的文件

Cornerstone——>Preference——>Subversion——>Global ignores中添加,去掉“use default global ignores”即可。

Cornerstone忽略不必要的文件

三、用命令行忽略文件

若要设置忽略xcuserdata目录,需要:

  1. cd到*.xcodeproj目录下面
    cd /Xcode_Project/Qzone-for-iPhone_WorkingCopy/iphone_qzone_proj/trunk/src/Libraries/blur/blur.xcodeproj

  2. 执行:
    svn propset svn:ignore xcuserdata .

  3. 退到工程根目录
    cd /Xcode_Project/Qzone-for-iPhone_WorkingCopy/iphone_qzone_proj/trunk/src/

  4. svn st
    M Libraries/blur/blur.xcodeproj

  5. svn ci

搞定。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325562221&siteId=291194637