1. 程式人生 > >ios 專案 .gitignore 檔案配置

ios 專案 .gitignore 檔案配置

能夠列入到程式碼版本控制的檔案是有規定的,不能是編寫的二進位制檔案、臨時檔案和使用者特有的檔案等。

本人用的xcode 是8.3.3版本

xcode4 以上版本,我認為必要的配置項為:

# Xcode
.DS_Store
build/
xcuserdata/
xcshareddata/
.idea/


如果是xcode 3 和xcode 4版本

檔案考慮到了X code 3和4差別,需要過濾的檔案多出一些

# Exclude the build directory   

build/*   
# Exclude temp nibs and swap files   

*~.nib  
*.swp  

  

# Exclude OS X folder attributes   
.DS_Store  

  

# Exclude user-specific XCode 3 and 4 files   

*.mode1  
*.mode1v3  
*.mode2v3  

  

*.perspective  
*.perspectivev3  
*.pbxuser  
*.xcworkspace  
xcuserdata  

 

# Exclude the build directory
build/*


# Exclude temp nibs and swap files

*~.nib

*.swp


# Exclude OS X folder attributes
.DS_Store


# Exclude user-specific XCode 3 and 4 files
*.mode1
*.mode1v3
*.mode2v3
*.perspective
*.perspectivev3
*.pbxuser

*.xcworkspace

xcuserdata


如果考慮適用於所有的Xcode工程,則需要使用git config命令配置git,在終端中執行git config命令:

$ git config –global core.excludesfile  ~/.gitignore

該命令會將配置資訊寫入到~/.gitconfig檔案中,–global引數是配置全域性資訊,~/.gitignore說明檔案是放置於當前使用者目錄下。