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

Re: [PATCH] Add git-find-new-files to spot files added to the tree, but not the repository

From
Junio C Hamano <junkio@cox.net>
Date
Jul 23, 2005, 20:44 UTC
Message-ID
<7vsly5qmkd.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20050723074219.GB3255@mythryan2.michonline.com>
Ryan Anderson <ryan@michonline.com> writes:
> Add git-find-new-files to find files that are in the tree, but
> not checked into the repository.
You _ought_ to be able to just say:
 $ git-ls-files --others --exclude-from=<exclude pattern file>

and be done with it. Also please see the thread about Cogito and StGIT's use of .gitignore and .git/exclude files.

The current implementation of "git-ls-files" exclude mechanism may have rooms for improvements; the last time I checked, it only did the matching of patterns against filename without leading directories). The world will be a better place if somebody extends it, instead of working around its limitation.

I may be tempted to doing it myself, but I'm in the middle of something else, so ...

Show 7 quoted lines
> +#	find . -name .git -type d -prune -o -type f -print \
> +#		| grep -v -e .tree1 -e .tree2 \
> +#		| sed -e "s/^\.\///" \
> +#		| sort >.tree1
> +#	git-ls-files | grep -v -e .tree1 -e .tree2 \
> +#		| sort >.tree2
> +#	diff -u .tree1 .tree2

It does not matter since the above is just an example and I think you should be able to just use "ls-files --others", but just FYI, you could have written "comm -23 .tree1 .tree2" above instead of "diff -u".

Previous: Ryan Anderson
Message 5 of 5 in “Add git-find-new-files to spot files added to the tree, but not the repository”
  1. Add git-find-new-files to spot files added to the tree, but not the repositoryRyan Anderson, Jul 23, 2005
  2. Linus TorvaldsJul 23, 2005
  3. Linus TorvaldsJul 23, 2005
  4. Ryan AndersonJul 25, 2005
  5. Junio C HamanoJul 23, 2005

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.