.gitignore
In Git, a lot of times you just want to submit code to the repository, rather than the file in the current directory of all the files submitted to the Git repository, such as MacOS system in the following .DS_Store
file or record Xocde of operation, or a pod in a long list of library source code. In this case use .gitignore
can automatically ignore these files submitted in Git.
Ignore format
#
: This is a comment - will be ignored Git*.a
: Ignore all.a
files ending in!lib.a
: Do not Ignorelib.a
file/TODO
: Just ignore the next project root directoryTODO
files are not includedsubdir/TODO
build/
: Ignorebuild/
all files in a directorydoc/*.txt
: Ignoredoc/notes.txt
but does not includedoc/server/arch.txt
Creation Method
From github get on
Compiled some common needs on github project file configuration to be ignored, be acquired as needed
https://github.com/github/gitignore.git
Three related files in Xcode
- Xcode.gitignore
- Objective-C.gitignore
- Swift.gitignore
Xcode.gitignore
Ignore the Xcode
configuration information, such as recording operation, by default windows, etc.
In the other two Xcode.gitignore
were ignored for different languages on the basis of
These files will rewrite named .gittignore
$ mv Swift.gitignore .gittignore
By gitignore.io created (recommended)
First Custom Terminal command:
macOS default is \#!/bin/bash
:
$ echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.bash_profile && source ~/.bash_profile
if #!/bin/zsh
$ echo "function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;}" >> ~/.zshrc && source ~/.zshrc
use
In the current terminal directory
$ gi swift > .gitignore
Swifit will be created for the type of project .gitignore
files.