Xcode 工程 Git配置参考

全局配置

1、根目录下touch .gitignore_global
2、在创建的文件中写入如下内容:

1
2
3
4
5
6
7
8
9
# .gitignore_global

.DS_Store
.DS_Store?
*.DS_Store
*/.DS_Store

*/.xcuserstate
*.xcuserstate

3、打开根目录下的.gitconfig,添加如下内容:

1
2
[core]
excludesfile = /Users/mac/.gitignore_global

1、注意:mac替换成你自己的电脑名称

顺便把以下内容一起写入:

1
2
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

这段文字的意思是给git log配置一个别名:git lg,可以更优雅地显示提交日志,不信你试试。当然,原有的git log可以正常使用。

工程配置

1、在工程目录下touch .gitignore
2、在Github上的忽略配置上找到对应的忽略配置,写入.gitignore

其他问题

如果本地或远端已经产生需要忽略的文件,问题仍然没有得到解决。

作如下操作:

  • git rm --cached file_path
  • git commit -m "xxoo"
  • git push

注意:git rm --cached file_path只是删除暂存区的文件,本地的文件不会删除,而git rm file_path则会删除文件。

您的支持将鼓励我继续创作!
0%