Ever I just known setting some wildcard patterns in .gitignore to exclude useless files.
If some object files( .o ) are in a lot of dirs with different depth,
like a/a.o, a/b/b.o, a/b/c/c.o
then I have to set
*/*.o
*/*/*.o
*/*/*/*.o
in .gitignore
Oh, it's a nightmare.
.git/info/exclude is the very file to achieve that.
*.o is enough.
In some circumstances, we need a few including from the excluding type,
set a ! (bang) at the beginning of the name.
A clear instance from gitignore manual page:
set a ! (bang) at the beginning of the name.
A clear instance from gitignore manual page:
$ git status
[...]
# Untracked files:
[...]
# Documentation/foo.html
# Documentation/gitignore.html
# file.o
# lib.a
# src/internal.o
[...]
$ cat .git/info/exclude
# ignore objects and archives, anywhere in the tree.
*.[oa]
$ cat Documentation/.gitignore
# ignore generated html files,
*.html
# except foo.html which is maintained by hand
!foo.html
$ git status
[...]
# Untracked files:
[...]
# Documentation/foo.html
[...]
No comments:
Post a Comment