git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* submodule: allow submodule directory in gitignore
@ 2015-10-12  6:30 Aleksey Komarov
  2015-10-16  9:33 ` Aleksey Komarov
  2015-10-17 12:46 ` Jiang Xin
  0 siblings, 2 replies; 4+ messages in thread
From: Aleksey Komarov @ 2015-10-12  6:30 UTC (permalink / raw)
  To: git

Hi all!

I'm sorry if the letter came twice. I have troubles with my post client.

I want to organize my repository so its submodules would be located at the root
of repository. I'm trying to create .gitignore to ignore all files and don't
ignore directories at the same time:

$ cat .gitignore
*
!*/

Now, I'm trying to add a submodule to my repository, but fail to understand why
my .gitignore prevents it from being added. I use the following command to check
if my submodule will be ignored or not:

$ git add --dry-run --ignore-missing c/

I have noticed that result of this check is different when directory c/ already
exists and when it still doesn't by the time of the check.
The described behavior is illustrated by the following example:

$ mkdir git_test
$ cd git_test
$ git init
Initialized empty Git repository in D:/temp/git_test/.git/
$ echo \* >> .gitignore
$ echo \!\*\/ >> .gitignore
$ git add --dry-run --ignore-missing c/
The following paths are ignored by one of your .gitignore files:
c/
Use -f if you really want to add them.
$ mkdir c
$ git add --dry-run --ignore-missing c/
$

Is this behavior expected? If yes, where can I read about it? Which part of the
Git documentation should I consult?
How should I correct my .gitignore to pass this check in both cases, when
directory c/ exists and when it doesn't?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-19  2:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12  6:30 submodule: allow submodule directory in gitignore Aleksey Komarov
2015-10-16  9:33 ` Aleksey Komarov
2015-10-17 12:46 ` Jiang Xin
2015-10-19  2:24   ` Aleksey Komarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).