我需要在我的.gitignore文件中添加一些规则。但是,我在项目文件夹中找不到它。它不是由Xcode自动创建的吗?如果没有,什么命令允许我创建一个?
当前回答
我用notepad++。使用菜单文件→新建文件→另存为→.gitignore(另存为类型:所有类型(.))
其他回答
在Windows中,打开DOS提示符(cmd)窗口,并使用以下命令行:
type > .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
Do:
打开Git终端 转到项目的Git存储库 通过触摸.gitignore命令创建一个.gitignore文件 使用git add .gitignore命令添加忽略文件 在ignore文件中设置ignore规则 执行cat .gitignore命令
通过在步骤3中运行命令,您将在项目目录中获得.gitignore文件。
使用Git Bash控制台。
导航到您的项目 输入touch .gitignore
将为您创建.gitignore文件。
非常简单(有时):只需将以下内容添加到您首选的命令行界面(GNU Bash, Git Bash等)
touch .gitignore
正如War在评论中指出的那样,只要你提供完整的路径,触摸在Windows上也可以工作。这可能也解释了为什么它对Windows上的一些用户不起作用:在默认情况下,触摸命令似乎不在某些Windows版本的$PATH中。
C:\> "c:\program files (x86)\git\bin\touch.exe" .gitignore
注意:路径可能不同,取决于您的安装和安装路径。