如何忽略Git目录中的文件?

时间:2022-08-25 23:28:15

What is the proper syntax for the .gitignore file to ignore files in a directory?

.gitignore文件在目录中忽略文件的正确语法是什么?

Would it be

config/databases.yml
cache/*
log/*
data/sql/*
lib/filter/base/*
lib/form/base/*
lib/model/map/*
lib/model/om/*

or

/config/databases.yml
/cache/*
/log/*
/data/sql/*
/lib/filter/base/*
/lib/form/base/*
/lib/model/map/*
/lib/model/om/*

?

吗?

10 个解决方案

#1


335  

PATTERN FORMAT

模式的格式

  • A blank line matches no files, so it can serve as a separator for readability.

    空行不匹配任何文件,因此它可以作为可读性的分隔符。

  • A line starting with # serves as a comment.

    以#开头的一行作为注释。

  • An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources.

    一个可选的前缀!否定的模式;任何由先前模式排除的匹配文件将再次包含。如果一个反模式匹配,那么将覆盖较低的优先模式源。

  • If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in git).

    如果模式以一个斜杠结束,它将被删除,以达到以下描述的目的,但它只会找到与目录匹配的内容。换句话说,foo/将匹配一个目录foo和它下面的路径,但是不会匹配一个常规文件或一个符号链接foo(这与在git中通用的pathspec是一致的)。

  • If the pattern does not contain a slash /, git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).

    如果该模式不包含斜杠/,git将其视为一个shell glob模式,并检查相对于.gitignore文件的位置与路径名的匹配(相对于工作树的顶层,如果不是来自.gitignore文件)。

  • Otherwise, git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, Documentation/*.html matches Documentation/git.html but not Documentation/ppc/ppc.html or tools/perf/Documentation/perf.html.

    否则,git将模式视为适合于fnmatch(3)使用FNM_PATHNAME标记的shell glob:模式中的通配符将与路径名不匹配。例如,文档/ *。html匹配文档/ git。html而不是文档/ ppc / ppc。html或工具/性能/文档/ perf.html。

  • A leading slash matches the beginning of the pathname. For example, /*.c matches cat-file.c but not mozilla-sha1/sha1.c.

    一个主要的斜杠匹配路径名的开头。例如,/ *。c cat-file匹配。c而不是mozilla-sha1 / sha1.c。

You can find more here

git help gitignore
or
man gitignore

git帮助gitignore或man gitignore。

#2


170  

It would be the former. Go by extensions as well instead of folder structure.

它将是前者。通过扩展来代替文件夹结构。

I.e. my example C# development ignore file:

例如,我的示例c#开发忽略文件:

#OS junk files
[Tt]humbs.db
*.DS_Store

#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
ipch/
obj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*

#Project files
[Bb]uild/

#Subversion files
.svn

# Office Temp Files
~$*

Update

更新

I thought I'd provide an update from the comments below. Although not directly answering the OP's question, see the following for more examples of .gitignore syntax.

我想从下面的评论中提供一个更新。虽然没有直接回答OP的问题,但是请参见下面的例子以获得更多的.gitignore语法。

Community wiki (constantly being updated):

社区维基(不断更新):

.gitignore for Visual Studio Projects and Solutions

.gitignore为Visual Studio项目和解决方案。

More examples with specific language use can be found here (thanks to Chris McKnight's comment):

更多使用特定语言的例子可以在这里找到(感谢Chris McKnight的评论):

https://github.com/github/gitignore

https://github.com/github/gitignore

#3


109  

Paths which contain slashes are taken to be relative to the directory containing the .gitignore file - usually the top level of your repository, though you can also place them in subdirectories.

包含斜杠的路径相对于包含.gitignore文件的目录(通常是存储库的顶层),不过您也可以将它们放在子目录中。

So, since in all of the examples you give, the paths contain slashes, the two versions are identical. The only time you need to put a leading slash is when there isn't one in the path already. For example, to ignore foo only at the top level of the repository, use /foo. Simply writing foo would ignore anything called foo anywhere in the repository.

所以,因为在你给出的所有例子中,路径包含了斜杠,两个版本是相同的。唯一需要放置一个引导斜杠的时间是在已经没有路径的时候。例如,仅在存储库的顶层忽略foo,使用/foo。简单地写foo就会忽略存储库中的任何foo。

Your wildcards are also redundant. If you want to ignore an entire directory, simply name it:

您的通配符也是冗余的。如果您想忽略整个目录,只需将其命名为:

lib/model/om

The only reason to use wildcards the way you have is if you intend to subsequently un-ignore something in the directory:

使用通配符的惟一理由是,如果您打算随后在目录中忽略某些内容:

lib/model/om/*      # ignore everything in the directory
!lib/model/om/foo   # except foo

#4


76  

A leading slash indicates that the ignore entry is only to be valid with respect to the directory in which the .gitignore file resides. Specifying *.o would ignore all .o files in this directory and all subdirs, while /*.o would just ignore them in that dir, while again, /foo/*.o would only ignore them in /foo/*.o.

一个主要的斜杠表示,忽略条目只对.gitignore文件所在的目录有效。指定*。在这个目录中,o将忽略所有的。o文件和所有的subdirs,而/*。o会在那个目录中忽略它们,再一次,/foo/*。o只能在/foo/*.o中忽略它们。

#5


26  

If you want to put a .gitignore file at the top level and make it work for any folder below it use /**/.

如果您想要将.gitignore文件放在顶层,并使其适用于下面的任何文件夹,请使用/**/。

E.g. to ignore all *.map files in a /src/main/ folder and sub-folders use:

忽略所有的*。地图文件/src/主/文件夹和子文件夹使用:

/src/main/**/*.map

#6


21  

Both examples in the question are actually very bad examples that can lead to data loss!

这两个例子都是非常糟糕的例子,会导致数据丢失!

My advise: never append /* to directories in .gitignore files, unless you have a good reason!

我的建议:永远不要在.gitignore文件中添加/*目录,除非你有一个很好的理由!

A good reason would be for example what Jefromi wrote: "if you intend to subsequently un-ignore something in the directory".

一个很好的理由就是Jefromi所写的:“如果你打算随后在目录中忽略某些东西”。

The reason why it otherwise shouldn't be done is that appending /* to directories does on the one hand work in the manner that it properly ignores all contents of the directory, but on the other hand it has a dangerous side effect:

不应该这样做的原因是,在一个手工上附加/*对目录的操作,它正确地忽略了目录的所有内容,但是另一方面,它有一个危险的副作用:

If you execute git stash -u (to temporarily stash tracked and untracked files) or git clean -df (to delete untracked but keep ignored files) in your repository, all directories that are ignored with an appended /* will be irreversibly deleted!

如果您执行git存储-u(临时存放跟踪和未跟踪的文件)或git clean -df(在您的存储库中删除未跟踪的但保留被忽略的文件),所有被附加/*忽略的目录将被不可撤销地删除!

Some background

I had to learn this the hard way. Somebody in my team was appending /* to some directories in our .gitignore. Over the time I had occasions where certain directories would suddenly disappear. Directories with gigabytes of local data needed by our application. Nobody could explain it and I always hat to re-download all data. After a while I got a notion that it might have to do with git stash. One day I wanted to clean my local repo (while keeping ignored files) and I was using git clean -df and again my data was gone. This time I had enough and investigated the issue. I finally figured that the reason is the appended /*.

我不得不艰难地学习这一点。我的团队中有人在我们的。gitignore中添加了一些目录。在这段时间里,某些目录会突然消失。使用我们的应用程序所需的gb本地数据的目录。没人能解释,我总是重新下载所有数据。过了一会儿,我有了一个想法,那就是它可能与git存储有关。有一天,我想要清理本地的repo(同时保留被忽略的文件),而我使用的是git clean -df,我的数据又被删除了。这次我受够了,调查了这个问题。我终于明白了,原因是附加/*。

I assume it can be explained somehow by the fact that directory/* does ignore all contents of the directory but not the directory itself. Thus it's neither considered tracked nor ignored when things get deleted. Even though git status and git status --ignored give a slightly different picture on it.

我认为可以通过目录/*忽略目录的所有内容,而不是目录本身来解释它。因此,当被删除时,它既不会被考虑跟踪,也不会被忽略。即使git的状态和git的状态——忽略了它的稍微不同的图片。

How to reproduce

Here is how to reproduce the behaviour. I'm currently using Git 2.8.4.

下面是如何重现这种行为。我现在使用的是Git 2.8.4。

A directory called localdata/ with a dummy file in it (important.dat) will be created in a local git repository and the contents will be ignored by putting /localdata/* into the .gitignore file. When one of the two mentioned git commands is executed now, the directory will be (unexpectedly) lost.

将在本地git存储库中创建一个名为localdata/的名为localdata/的目录(important.dat),其中的内容将被放置/localdata/*放到.gitignore文件中。当其中一个提到的git命令现在执行时,目录将(意外地)丢失。

mkdir test
cd test
git init
echo "/localdata/*" >.gitignore
git add .gitignore
git commit -m "Add .gitignore."
mkdir localdata
echo "Important data" >localdata/important.dat
touch untracked-file

If you do a git status --ignored here, you'll get:

如果你做了一个git状态——在这里被忽略,你会得到:

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

  untracked-file

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

  localdata/

Now either do

现在不是做

git stash -u
git stash pop

or

git clean -df

In both cases the allegedly ignored directory localdata will be gone!

在这两种情况下,据称被忽略的目录localdata都将消失!

Not sure if this can be considered a bug, but I guess it's at least a feature that nobody needs.

不确定这是否可以被认为是bug,但我想这至少是一个没有人需要的特性。

I'll report that to the git development list and see what they think about it.

我将向git开发列表报告这一点,看看他们是怎么想的。

#7


14  

It would be:

这将是:

config/databases.yml
cache
log
data/sql
lib/filter/base
lib/form/base
lib/model/map
lib/model/om

or possibly even:

或甚至可能:

config/databases.yml
cache
log
data/sql
lib/*/base
lib/model/map
lib/model/om

in case that filter and form are the only directories in lib that do have a basesubdirectory that needs to be ignored (see it as an example of what you can do with the asterics).

如果过滤器和表单是lib中唯一的目录,那么它就有一个需要忽略的basesubdirectory(请把它看作是您可以使用星号的示例)。

#8


13  

The first one. Those file paths are relative from where your .gitignore file is.

第一个。这些文件路径与您的.gitignore文件的位置相关。

#9


3  

I'm maintaining a GUI and CLI based service that allows you to generate .gitignore templates very easily at https://www.gitignore.io.

我正在维护一个基于GUI和CLI的服务,允许您在https://www.gitignore.io上很容易地生成.gitignore模板。

You can either type the templates you want in the search field or install the command line alias and run

您可以在搜索字段中键入所需的模板,或者安装命令行别名并运行。

$ gi swift,osx

胃肠道迅速美元,osx

#10


0  

A sample .gitignore file can look like one below for a Android Studio project

一个示例.gitignore文件可以看起来像下面的一个Android Studio项目。

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties


#Eclipse
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
YourProjetcName/.gradle/
YourProjetcName/app/build/
*/YourProjetcName/.gradle/
*/YourProjetcName/app/build/

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/
/build
build/
*/build/
*/*/build/
*/*/*/build/
*.bin
*.lock
YourProjetcName/app/build/
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
.gradle/
app/build/
*app/build/

# Local configuration file (sdk path, etc)
local.properties
/YourProjetcName/build/intermediates/lint-cache/api-versions-6-23.1.bin
appcompat_v7_23_1_1.xml
projectFilesBackup
build.gradle
YourProjetcName.iml
YourProjetcName.iml
gradlew
gradlew.bat
local.properties
settings.gradle
.gradle
.idea
android
build
gradle

#1


335  

PATTERN FORMAT

模式的格式

  • A blank line matches no files, so it can serve as a separator for readability.

    空行不匹配任何文件,因此它可以作为可读性的分隔符。

  • A line starting with # serves as a comment.

    以#开头的一行作为注释。

  • An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources.

    一个可选的前缀!否定的模式;任何由先前模式排除的匹配文件将再次包含。如果一个反模式匹配,那么将覆盖较低的优先模式源。

  • If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in git).

    如果模式以一个斜杠结束,它将被删除,以达到以下描述的目的,但它只会找到与目录匹配的内容。换句话说,foo/将匹配一个目录foo和它下面的路径,但是不会匹配一个常规文件或一个符号链接foo(这与在git中通用的pathspec是一致的)。

  • If the pattern does not contain a slash /, git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).

    如果该模式不包含斜杠/,git将其视为一个shell glob模式,并检查相对于.gitignore文件的位置与路径名的匹配(相对于工作树的顶层,如果不是来自.gitignore文件)。

  • Otherwise, git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not match a / in the pathname. For example, Documentation/*.html matches Documentation/git.html but not Documentation/ppc/ppc.html or tools/perf/Documentation/perf.html.

    否则,git将模式视为适合于fnmatch(3)使用FNM_PATHNAME标记的shell glob:模式中的通配符将与路径名不匹配。例如,文档/ *。html匹配文档/ git。html而不是文档/ ppc / ppc。html或工具/性能/文档/ perf.html。

  • A leading slash matches the beginning of the pathname. For example, /*.c matches cat-file.c but not mozilla-sha1/sha1.c.

    一个主要的斜杠匹配路径名的开头。例如,/ *。c cat-file匹配。c而不是mozilla-sha1 / sha1.c。

You can find more here

git help gitignore
or
man gitignore

git帮助gitignore或man gitignore。

#2


170  

It would be the former. Go by extensions as well instead of folder structure.

它将是前者。通过扩展来代替文件夹结构。

I.e. my example C# development ignore file:

例如,我的示例c#开发忽略文件:

#OS junk files
[Tt]humbs.db
*.DS_Store

#Visual Studio files
*.[Oo]bj
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.[Cc]ache
*.ilk
*.log
*.lib
*.sbr
*.sdf
ipch/
obj/
[Bb]in
[Dd]ebug*/
[Rr]elease*/
Ankh.NoLoad

#Tooling
_ReSharper*/
*.resharper
[Tt]est[Rr]esult*

#Project files
[Bb]uild/

#Subversion files
.svn

# Office Temp Files
~$*

Update

更新

I thought I'd provide an update from the comments below. Although not directly answering the OP's question, see the following for more examples of .gitignore syntax.

我想从下面的评论中提供一个更新。虽然没有直接回答OP的问题,但是请参见下面的例子以获得更多的.gitignore语法。

Community wiki (constantly being updated):

社区维基(不断更新):

.gitignore for Visual Studio Projects and Solutions

.gitignore为Visual Studio项目和解决方案。

More examples with specific language use can be found here (thanks to Chris McKnight's comment):

更多使用特定语言的例子可以在这里找到(感谢Chris McKnight的评论):

https://github.com/github/gitignore

https://github.com/github/gitignore

#3


109  

Paths which contain slashes are taken to be relative to the directory containing the .gitignore file - usually the top level of your repository, though you can also place them in subdirectories.

包含斜杠的路径相对于包含.gitignore文件的目录(通常是存储库的顶层),不过您也可以将它们放在子目录中。

So, since in all of the examples you give, the paths contain slashes, the two versions are identical. The only time you need to put a leading slash is when there isn't one in the path already. For example, to ignore foo only at the top level of the repository, use /foo. Simply writing foo would ignore anything called foo anywhere in the repository.

所以,因为在你给出的所有例子中,路径包含了斜杠,两个版本是相同的。唯一需要放置一个引导斜杠的时间是在已经没有路径的时候。例如,仅在存储库的顶层忽略foo,使用/foo。简单地写foo就会忽略存储库中的任何foo。

Your wildcards are also redundant. If you want to ignore an entire directory, simply name it:

您的通配符也是冗余的。如果您想忽略整个目录,只需将其命名为:

lib/model/om

The only reason to use wildcards the way you have is if you intend to subsequently un-ignore something in the directory:

使用通配符的惟一理由是,如果您打算随后在目录中忽略某些内容:

lib/model/om/*      # ignore everything in the directory
!lib/model/om/foo   # except foo

#4


76  

A leading slash indicates that the ignore entry is only to be valid with respect to the directory in which the .gitignore file resides. Specifying *.o would ignore all .o files in this directory and all subdirs, while /*.o would just ignore them in that dir, while again, /foo/*.o would only ignore them in /foo/*.o.

一个主要的斜杠表示,忽略条目只对.gitignore文件所在的目录有效。指定*。在这个目录中,o将忽略所有的。o文件和所有的subdirs,而/*。o会在那个目录中忽略它们,再一次,/foo/*。o只能在/foo/*.o中忽略它们。

#5


26  

If you want to put a .gitignore file at the top level and make it work for any folder below it use /**/.

如果您想要将.gitignore文件放在顶层,并使其适用于下面的任何文件夹,请使用/**/。

E.g. to ignore all *.map files in a /src/main/ folder and sub-folders use:

忽略所有的*。地图文件/src/主/文件夹和子文件夹使用:

/src/main/**/*.map

#6


21  

Both examples in the question are actually very bad examples that can lead to data loss!

这两个例子都是非常糟糕的例子,会导致数据丢失!

My advise: never append /* to directories in .gitignore files, unless you have a good reason!

我的建议:永远不要在.gitignore文件中添加/*目录,除非你有一个很好的理由!

A good reason would be for example what Jefromi wrote: "if you intend to subsequently un-ignore something in the directory".

一个很好的理由就是Jefromi所写的:“如果你打算随后在目录中忽略某些东西”。

The reason why it otherwise shouldn't be done is that appending /* to directories does on the one hand work in the manner that it properly ignores all contents of the directory, but on the other hand it has a dangerous side effect:

不应该这样做的原因是,在一个手工上附加/*对目录的操作,它正确地忽略了目录的所有内容,但是另一方面,它有一个危险的副作用:

If you execute git stash -u (to temporarily stash tracked and untracked files) or git clean -df (to delete untracked but keep ignored files) in your repository, all directories that are ignored with an appended /* will be irreversibly deleted!

如果您执行git存储-u(临时存放跟踪和未跟踪的文件)或git clean -df(在您的存储库中删除未跟踪的但保留被忽略的文件),所有被附加/*忽略的目录将被不可撤销地删除!

Some background

I had to learn this the hard way. Somebody in my team was appending /* to some directories in our .gitignore. Over the time I had occasions where certain directories would suddenly disappear. Directories with gigabytes of local data needed by our application. Nobody could explain it and I always hat to re-download all data. After a while I got a notion that it might have to do with git stash. One day I wanted to clean my local repo (while keeping ignored files) and I was using git clean -df and again my data was gone. This time I had enough and investigated the issue. I finally figured that the reason is the appended /*.

我不得不艰难地学习这一点。我的团队中有人在我们的。gitignore中添加了一些目录。在这段时间里,某些目录会突然消失。使用我们的应用程序所需的gb本地数据的目录。没人能解释,我总是重新下载所有数据。过了一会儿,我有了一个想法,那就是它可能与git存储有关。有一天,我想要清理本地的repo(同时保留被忽略的文件),而我使用的是git clean -df,我的数据又被删除了。这次我受够了,调查了这个问题。我终于明白了,原因是附加/*。

I assume it can be explained somehow by the fact that directory/* does ignore all contents of the directory but not the directory itself. Thus it's neither considered tracked nor ignored when things get deleted. Even though git status and git status --ignored give a slightly different picture on it.

我认为可以通过目录/*忽略目录的所有内容,而不是目录本身来解释它。因此,当被删除时,它既不会被考虑跟踪,也不会被忽略。即使git的状态和git的状态——忽略了它的稍微不同的图片。

How to reproduce

Here is how to reproduce the behaviour. I'm currently using Git 2.8.4.

下面是如何重现这种行为。我现在使用的是Git 2.8.4。

A directory called localdata/ with a dummy file in it (important.dat) will be created in a local git repository and the contents will be ignored by putting /localdata/* into the .gitignore file. When one of the two mentioned git commands is executed now, the directory will be (unexpectedly) lost.

将在本地git存储库中创建一个名为localdata/的名为localdata/的目录(important.dat),其中的内容将被放置/localdata/*放到.gitignore文件中。当其中一个提到的git命令现在执行时,目录将(意外地)丢失。

mkdir test
cd test
git init
echo "/localdata/*" >.gitignore
git add .gitignore
git commit -m "Add .gitignore."
mkdir localdata
echo "Important data" >localdata/important.dat
touch untracked-file

If you do a git status --ignored here, you'll get:

如果你做了一个git状态——在这里被忽略,你会得到:

On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

  untracked-file

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)

  localdata/

Now either do

现在不是做

git stash -u
git stash pop

or

git clean -df

In both cases the allegedly ignored directory localdata will be gone!

在这两种情况下,据称被忽略的目录localdata都将消失!

Not sure if this can be considered a bug, but I guess it's at least a feature that nobody needs.

不确定这是否可以被认为是bug,但我想这至少是一个没有人需要的特性。

I'll report that to the git development list and see what they think about it.

我将向git开发列表报告这一点,看看他们是怎么想的。

#7


14  

It would be:

这将是:

config/databases.yml
cache
log
data/sql
lib/filter/base
lib/form/base
lib/model/map
lib/model/om

or possibly even:

或甚至可能:

config/databases.yml
cache
log
data/sql
lib/*/base
lib/model/map
lib/model/om

in case that filter and form are the only directories in lib that do have a basesubdirectory that needs to be ignored (see it as an example of what you can do with the asterics).

如果过滤器和表单是lib中唯一的目录,那么它就有一个需要忽略的basesubdirectory(请把它看作是您可以使用星号的示例)。

#8


13  

The first one. Those file paths are relative from where your .gitignore file is.

第一个。这些文件路径与您的.gitignore文件的位置相关。

#9


3  

I'm maintaining a GUI and CLI based service that allows you to generate .gitignore templates very easily at https://www.gitignore.io.

我正在维护一个基于GUI和CLI的服务,允许您在https://www.gitignore.io上很容易地生成.gitignore模板。

You can either type the templates you want in the search field or install the command line alias and run

您可以在搜索字段中键入所需的模板,或者安装命令行别名并运行。

$ gi swift,osx

胃肠道迅速美元,osx

#10


0  

A sample .gitignore file can look like one below for a Android Studio project

一个示例.gitignore文件可以看起来像下面的一个Android Studio项目。

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties


#Eclipse
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
YourProjetcName/.gradle/
YourProjetcName/app/build/
*/YourProjetcName/.gradle/
*/YourProjetcName/app/build/

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/
/build
build/
*/build/
*/*/build/
*/*/*/build/
*.bin
*.lock
YourProjetcName/app/build/
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
.gradle/
app/build/
*app/build/

# Local configuration file (sdk path, etc)
local.properties
/YourProjetcName/build/intermediates/lint-cache/api-versions-6-23.1.bin
appcompat_v7_23_1_1.xml
projectFilesBackup
build.gradle
YourProjetcName.iml
YourProjetcName.iml
gradlew
gradlew.bat
local.properties
settings.gradle
.gradle
.idea
android
build
gradle