# Re: [gitgitgadget/git] Adding git-ignore command, tests, and documentation. (#264)

2 messages from 2019-07-17 to 2019-07-17. Participants: Thurston Stone.
Thread: https://gitlist.dev/t/51493

## Thurston Stone, 2019-07-17 17:12

Subject: Re: [gitgitgadget/git] Adding git-ignore command, tests, and documentation. (#264)
Message-ID: <YmOpqT5Q4a9QdU5RJmIbisRhQMnkcZt7GFT7E0xH4cqAWr0mEiHlYzLmpI8eKSPPQDZmQRmfUzdzqxDSb-iBwYhFHtJ6edCFb8I05ld0vFM=@protonmail.com>
URL: https://gitlist.dev/e/YmOpqT5Q4a9QdU5RJmIbisRhQMnkcZt7GFT7E0xH4cqAWr0mEiHlYzLmpI8eKSPPQDZmQRmfUzdzqxDSb-iBwYhFHtJ6edCFb8I05ld0vFM%3D%40protonmail.com
In-Reply-To: <gitgitgadget/git/pull/264/c512358757@github.com>

```
> Wouldn't this simpler to type and less error prone, as you do
> have to
>	$ cd path/to/the
>	... work in that deep
>	... realize that file.txt in that directory needs ignoring ...
>	$ echo file.txt > .gitignore
that would have "path/to/the/.gitignore" which contains "file.txt".
Whereas that does work fine, it can be cumbersome to manage a multitude
gitignore files (it can get out of hand). If a policy is in place to
consolidate this management into the root gitignore, they'd have to run:

$ cd path/to/the
	... work in that deep directory ...
	... realize that file.txt in that directory needs ignoring ...
	... know relative path of both desired ignore file and cwd ...
$ echo path/to/the/file.txt > ../../../.gitignore
	... or with this script ...
$ git ignore path/to/the/file.txt

Another example might be when the code is deeper embeded, like a
java library path.
$ cd code/src/com/mylib
	... work under that directory ...
	... realize subclass/helpers/testdata.json needs ignoring ...
 	... need to know the full path of ignore file, cwd, and
		the relative path to root gitignore ...
$ echo code/src/com/mylib/subclass/helpers/testdata.json > ../../../../.gitignore
- or the more intuitive: -
$ git ignore subclass/helpers/testdata.json
- both ending in the same result
$ cat ${REPO_ROOT}/.gitignore
code/src/com/mylib/subclass/helpers/testdata.json



```

## Thurston Stone, 2019-07-17 17:15

Subject: Re: [gitgitgadget/git] Adding git-ignore command, tests, and documentation. (#264)
Message-ID: <-_9xfW9lD1t4z4qkcMoJ5Jb9gmzayauqKOPDIYIQO4dJQzc-RoVWTNOi9-OsXDzrdhVJPWoRYIa5d0zqIsHBoNzMSuw1_jauUcEaGwIairU=@protonmail.com>
URL: https://gitlist.dev/e/-_9xfW9lD1t4z4qkcMoJ5Jb9gmzayauqKOPDIYIQO4dJQzc-RoVWTNOi9-OsXDzrdhVJPWoRYIa5d0zqIsHBoNzMSuw1_jauUcEaGwIairU%3D%40protonmail.com
In-Reply-To: <YmOpqT5Q4a9QdU5RJmIbisRhQMnkcZt7GFT7E0xH4cqAWr0mEiHlYzLmpI8eKSPPQDZmQRmfUzdzqxDSb-iBwYhFHtJ6edCFb8I05ld0vFM=@protonmail.com>

```
my mistake, my last email should have read:

$ cd path/to/the
 ... work in that deep directory ...
 ... realize that file.txt in that directory needs ignoring ...
 ... know relative path of both desired ignore file and cwd ...
$ echo path/to/the/file.txt > ../../../.gitignore
     ... or with this script ...
--CORRECTION--
$ git ignore file.txt

```
