git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Relative paths don't work in .gitignore as would be expected.

From
/#!/JoePea <trusktr@gmail.com>
Date
Feb 12, 2015, 06:28 UTC
Message-ID
<CAKU1PAU8zSa3jjPYC7egRxJkr9hM6FerVXLsaU7ieCOZwEFd0g@mail.gmail.com>
In-Reply-To
<CAKU1PAXgofoOqtFMrLYyRoFqNp3Poj-PO35eh1ukxR=h29FPfQ@mail.gmail.com>
+git@vger.kernel.org, plain text

I would say just use zsh globbing, it has the double star, but it'd likely too late for that. You'd add a single rule: ignore any files that are in a directory higher up than the .gitignore where the rule is found.

Then if you have a git repo in your fs at /git/repo with a /git/repo/.gitignore you could put /git/repo/*.js, *.js, or ./*.js to ignore the same thing (the absolute path may or may not bite the person in the ass when he moves the repo, but that's not our problem), so those would be equivalent to the current /*.js (give or take the absolute example). You could do **/*.js the zsh way to start ignoring things everywhere, equivalent to the current *.js. /#!/JoePea

On Tue, Feb 10, 2015 at 1:19 AM, /#!/JoePea <trusktr@gmail.com> wrote:
Show 13 quoted lines
> I would say just use zsh globbing, it has the double star, but it'd likely
> too late for that. You'd add a single rule: ignore any files that are in a
> directory higher up than the .gitignore where the rule is found.
>
> Then if you have a git repo in your fs at /git/repo with a
> /git/repo/.gitignore you could put /git/repo/*.js, *.js, or ./*.js to ignore
> the same thing (the absolute path may or may not bite the person in the ass
> when he moves the repo, but that's not our problem), so those would be
> equivalent to the current /*.js (give or take the absolute example). You
> could do **/*.js the zsh way to start ignoring things everywhere, equivalent
> to the current *.js.
>
> /#!/JoePea
Message 1 of 1 in “Re: Relative paths don't work in .gitignore as would be expected.”
  1. /#!/JoePeaFeb 12, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.