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

Re: Wildcards with git rm

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 30, 2017, 00:58 UTC
Message-ID
<xmqqk1zd8nac.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<cbb7340e-aa8c-1980-41eb-95cd965d4037@resplendentwebservices.com>
RPS <jim@resplendentwebservices.com> writes:
> git rm doesn't seem to be very useful without the use of shell
> wildcards, especially with the use of a .gitignore file. If a
> .gitignore file is used, the git rm command does not consider the
> .gitignore file, and errs out when an ignored file is present.
Do you mean
	$ git rm COPY*

would complain about COPYING~ on your filesystem, which would match the pattern "*~" you have in your .gitignore file, after editing the tracked COPYING file?

If so, you may choose to tell your shell _not_ to expand wildcards, as it does not know what is ignored, by doing

	$ git rm COPY\*

instead. That would allow "git rm" to expand wildcards _with_ the knowledge of what is and is not ignored. The shell does not know (probably you could teach if you wanted to, but it does not want to know) and care about .gitignore files when it does its wildcard expansion.

Previous: RPS
Message 2 of 2 in “Wildcards with git rm”
  1. RPSOct 28, 2017
  2. Junio C HamanoOct 30, 2017

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.