我需要在我的.gitignore文件中添加一些规则。但是,我在项目文件夹中找不到它。它不是由Xcode自动创建的吗?如果没有,什么命令允许我创建一个?


当前回答

使用Git Bash控制台。

导航到您的项目 输入touch .gitignore

将为您创建.gitignore文件。

其他回答

http://gitignore.io是一个开源实用程序,可以帮助您为项目创建有用的.gitignore文件。还有一个可以通过gi命令访问的命令行API: http://gitignore.io/cli

为OS X安装gi命令: $回声”功能gi () {curl http://gitignore.io/api /\$@ ;}" >> ~/.Bash_profile && source ~/.bash_profile 查看.gitignore文件内容(输出:http://gitignore.io/api/xcode,osx): $ gi xcode,osx 如果您想将结果附加到一个新的.gitignore文件中,那么您应该在终端上看到输出。 $ gi xcode,osx >> .gitignore

在Ubuntu中,你可以创建.gitignore文件,并从当前目录中添加(忽略)所有超过50mb的文件,.,使用:

find . -size +100M | cat >> .gitignore

默认情况下,.gitignore文件不会添加到存储库中。使用vi或你最喜欢的文本编辑器创建。gitignore文件,然后发出git add .gitignore,后跟git commit -m "message" .gitignore。下面的命令将处理它。

> .gitignore
git add .gitignore
git commit -m "message" .gitignore

创建一个.gitignore文件,包含所有你不想提交的文件和目录。

例子:

#################
## Eclipse
#################

*.pydevproject
.project
.metadata
.gradle
bin/
tmp/
target/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results

[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
.*crunch*.local.xml

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.Publish.xml
*.pubxml

# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/

# Windows Azure Build Output
csx
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings

窗户

文件名:“。gitignore”, 保存为类型:所有文件(.)