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

Re: How does Git know which files no longer needed during upgrade?

From
Jeff King <peff@peff.net>
Date
Mar 4, 2009, 12:38 UTC
Message-ID
<20090304123813.GA17521@coredump.intra.peff.net>
In-Reply-To
<loom.20090304T122643-455@post.gmane.org>
On Wed, Mar 04, 2009 at 12:28:07PM +0000, Stefan Näwe wrote:
Show 12 quoted lines
> > > cd /path/to/copy
> > > rm -rf *
> > > cp -a /path/to/new/version/* .
> > > git add -A
> > > git commit -m 'update foo to 2.0'
> > 
> > Nit: "rm -rf *" will miss files starting with '.'. So it is probably
> > simpler to say what you mean: delete all files managed by git:
> > 
> >   git ls-files -z | xargs -0 rm -f
> 
> But maybe one wants to keep a .gitignore file. 

True. The problem is that you have no way of saying "give me all the files that git cares about, except the ones that I put there manually and not from this tarball." If you guess that dot-files are manual and everything else isn't, then that is easy, but not necessarily right.

If you tagged the last import, you use "git ls-tree" to get you the list of files just from the tarball.

-Peff
Previous: Stefan Näwe
Message 5 of 5 in “How does Git know which files no longer needed during upgrade?”
  1. dealmakerMar 3, 2009
  2. Miklos VajnaMar 3, 2009
  3. Jeff KingMar 4, 2009
  4. Stefan NäweMar 4, 2009
  5. Jeff KingMar 4, 2009

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.