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

Re: way to automatically add untracked files?

From
Steffen Prohaska <prohaska@zib.de>
Date
Aug 5, 2007, 11:22 UTC
Message-ID
<8EA2C4F4-F947-427B-A1E8-ABAEB06C1360@zib.de>
In-Reply-To
<7v4pjeioi6.fsf@assigned-by-dhcp.cox.net>
On Aug 5, 2007, at 6:39 AM, Junio C Hamano wrote:
Show 10 quoted lines
>
> Adding _new_ files, unless you are just beginning a new project,
> are much more rare than updating modified files that you are
> already tracking; and "git add new-file..." is what people
> usually use for the former.  "git add ." is almost always the
> "initial import" and not used later (after all you ought to know
> what files you are creating and controlling ;-)).  You get into
> an illusion that that is often used, only when you have just
> started.  As your project progresses, that feeling will fade
> away.

I exactly need the functionality that Miles is describing for the following good reason:

Mac OS X has the notion of a bundle, which is a directory that contains related files that are fully controlled by the application that is writing that bundle. The bundle functionality is directly supported by the OS and most applications save their data as bundles. For example on Mac OS X, the Openoffice format, which packs related files in a zip file, would just be a directory with all related files grouped together (no ZIP archive needed).

So here is what I need: I want to be able to track a directory with all its contents. The data inside the directory are not under my control. It's only the directory that matters for me.

Git is already quite good at that because it doesn't need to place anything inside the opaque directory! Subversion for example has no chance because it clutters the directory with .svn directories, which will be removed by the next Save (an application first creates a new temporary directory, stores all data there, moves the old directory to a backup location, and renames the new directory to the final destination only if no problems occurred).

When I started with git I figured out that
    git-ls-files -z --others dir | git-update-index --add -z --stdin
    git commit -a
does the job for me. Would
    git add dir
    git add -u dir
    git commit
be equivalent, but restricted to the changes in dir?
	Steffen
Previous: Miles BaderNext: Johan Herland
Message 15 of 40 in “way to automatically add untracked files?”
  1. Miles BaderAug 5, 2007
  2. Shawn O. PearceAug 5, 2007
  3. Junio C HamanoAug 5, 2007
  4. Miles BaderAug 5, 2007
  5. Shawn O. PearceAug 5, 2007
  6. Miles BaderAug 5, 2007
  7. Junio C HamanoAug 5, 2007
  8. Miles BaderAug 5, 2007
  9. Junio C HamanoAug 5, 2007
  10. Miles BaderAug 5, 2007
  11. Junio C HamanoAug 5, 2007
  12. Miles BaderAug 5, 2007
  13. Johannes SchindelinAug 5, 2007
  14. Miles BaderAug 5, 2007
  15. Steffen ProhaskaAug 5, 2007
  16. Johan HerlandAug 5, 2007
  17. David KastrupAug 5, 2007
  18. Theodore TsoAug 5, 2007
  19. Johan HerlandAug 5, 2007
  20. Miles BaderAug 6, 2007
  21. Johannes SchindelinAug 6, 2007
  22. Miles BaderAug 6, 2007
  23. Johannes SchindelinAug 6, 2007
  24. Miles BaderAug 6, 2007
  25. Johan HerlandAug 6, 2007
  26. Johannes SchindelinAug 6, 2007
  27. Steffen ProhaskaAug 5, 2007
  28. Johannes SchindelinAug 6, 2007
  29. Steffen ProhaskaAug 6, 2007
  30. Jakub NarebskiAug 6, 2007
  31. Johan HerlandAug 6, 2007
  32. Junio C HamanoAug 6, 2007
  33. David KastrupAug 6, 2007
  34. Miles BaderAug 7, 2007
  35. Linus TorvaldsAug 5, 2007
  36. Junio C HamanoAug 5, 2007
  37. David KastrupAug 5, 2007
  38. Benchmarking git-add vs git-ls-files+update-index (was: way to automatically add untracked files?)David Kastrup, Aug 5, 2007
  39. Miles BaderAug 5, 2007
  40. Linus TorvaldsAug 5, 2007

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.