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


当前回答

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

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

其他回答

是的,Windows资源管理器不允许您创建此文件名。另一种简单的方法是在目录中创建一个虚拟文件,例如NewFile.txt,然后在Git Bash中简单地重命名它,如下所示:

mv NewFile.txt .gitignore

您可以直接创建一个空的.gitignore文件。在你需要添加该文件的位置打开cmd,并键入以下命令:

copy con .gitignore

按回车。我们现在处于新创建文件的编辑模式,但现在不需要添加任何东西。只需按F6,然后按Enter。

现在您有了一个空的.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”, 保存为类型:所有文件(.)