{"thread":{"id":"18123","subject":"How does Git know which files no longer needed during upgrade?","startedAt":"2009-03-03T21:51:14Z","lastAt":"2009-03-04T12:38:13Z","messageCount":5,"participants":["dealmaker","Miklos Vajna","Jeff King","Stefan Näwe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106932","messageId":"22318714.post@talk.nabble.com","threadId":"18123","inReplyTo":null,"subject":"How does Git know which files no longer needed during upgrade?","fromName":"dealmaker","fromEmail":"vinkhc@gmail.com","sentAt":"2009-03-03T21:51:14Z","receivedAt":"2009-03-03T21:51:14Z","isPatch":false,"sender":{"key":"vinkhc@gmail.com","avatar":null},"body":"\nHi,\n  I am going to upgrade software to a newer version in my main trunk, I\ndecide to download the newer version and checkout the main trunk and  copy\nit over to my main trunk.  If the older version has some files that are no\nlonger in the newer version, how does git determine whether to keep those\nfiles or not?  Does it even notify me that those files are no longer needed?\nThanks.\n-- \nView this message in context: http://www.nabble.com/How-does-Git-know-which-files-no-longer-needed-during-upgrade--tp22318714p22318714.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"106936","messageId":"20090303233058.GE4371@genesis.frugalware.org","threadId":"18123","inReplyTo":"22318714.post@talk.nabble.com","subject":"Re: How does Git know which files no longer needed during upgrade?","fromName":"Miklos Vajna","fromEmail":"vmiklos@frugalware.org","sentAt":"2009-03-03T23:30:58Z","receivedAt":"2009-03-03T23:30:58Z","isPatch":false,"sender":{"key":"vmiklos@frugalware.org","avatar":"https://gravatar.com/avatar/401c1cbbb3a5d13e650c691a2c71d6fd0b80df1a01bc74d9f1972675dd58f2bd?d=mp&s=160"},"body":"On Tue, Mar 03, 2009 at 01:51:14PM -0800, dealmaker <vinkhc@gmail.com> wrote:\n>   I am going to upgrade software to a newer version in my main trunk, I\n> decide to download the newer version and checkout the main trunk and  copy\n> it over to my main trunk.\n\nDo you mean the 'master' branch by 'main trunk'? Trunk is not in Git's\nterminology.\n\n> If the older version has some files that are no\n> longer in the newer version, how does git determine whether to keep those\n> files or not?  Does it even notify me that those files are no longer needed?\n\nFirst, I think storing upstream code (that you will never touch) in\nversion control is a horrible idea, but if you really do it, I would do\nsomething like:\n\ncd /path/to/copy\nrm -rf *\ncp -a /path/to/new/version/* .\ngit add -A\ngit commit -m 'update foo to 2.0'\n\nThat will add/update/delete files as you would expect.\n"},{"id":"106956","messageId":"20090304094951.GA32433@coredump.intra.peff.net","threadId":"18123","inReplyTo":"20090303233058.GE4371@genesis.frugalware.org","subject":"Re: How does Git know which files no longer needed during upgrade?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-04T09:49:51Z","receivedAt":"2009-03-04T09:49:51Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 04, 2009 at 12:30:58AM +0100, Miklos Vajna wrote:\n\n> First, I think storing upstream code (that you will never touch) in\n> version control is a horrible idea, but if you really do it, I would do\n> something like:\n> \n> cd /path/to/copy\n> rm -rf *\n> cp -a /path/to/new/version/* .\n> git add -A\n> git commit -m 'update foo to 2.0'\n\nNit: \"rm -rf *\" will miss files starting with '.'. So it is probably\nsimpler to say what you mean: delete all files managed by git:\n\n  git ls-files -z | xargs -0 rm -f\n\n-Peff\n"},{"id":"106970","messageId":"loom.20090304T122643-455@post.gmane.org","threadId":"18123","inReplyTo":"20090304094951.GA32433@coredump.intra.peff.net","subject":"Re: How does Git know which files no longer needed during upgrade?","fromName":"Stefan Näwe","fromEmail":"stefan.naewe+git@gmail.com","sentAt":"2009-03-04T12:28:07Z","receivedAt":"2009-03-04T12:28:07Z","isPatch":false,"sender":{"key":"stefan.naewe+git@gmail.com","avatar":"https://gravatar.com/avatar/ff9c89e7b42e5c7f494ef0f19ac9bde6693fb6465356711b8d4ed47d2108dd46?d=mp&s=160"},"body":"Jeff King <peff <at> peff.net> writes:\n\n> \n> > cd /path/to/copy\n> > rm -rf *\n> > cp -a /path/to/new/version/* .\n> > git add -A\n> > git commit -m 'update foo to 2.0'\n> \n> Nit: \"rm -rf *\" will miss files starting with '.'. So it is probably\n> simpler to say what you mean: delete all files managed by git:\n> \n>   git ls-files -z | xargs -0 rm -f\n> \n> -Peff\n\nBut maybe one wants to keep a .gitignore file. \n\nRegrads,\nStefan\n"},{"id":"106971","messageId":"20090304123813.GA17521@coredump.intra.peff.net","threadId":"18123","inReplyTo":"loom.20090304T122643-455@post.gmane.org","subject":"Re: How does Git know which files no longer needed during upgrade?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-04T12:38:13Z","receivedAt":"2009-03-04T12:38:13Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 04, 2009 at 12:28:07PM +0000, Stefan Näwe wrote:\n\n> > > cd /path/to/copy\n> > > rm -rf *\n> > > cp -a /path/to/new/version/* .\n> > > git add -A\n> > > git commit -m 'update foo to 2.0'\n> > \n> > Nit: \"rm -rf *\" will miss files starting with '.'. So it is probably\n> > simpler to say what you mean: delete all files managed by git:\n> > \n> >   git ls-files -z | xargs -0 rm -f\n> \n> But maybe one wants to keep a .gitignore file. \n\nTrue. The problem is that you have no way of saying \"give me all the\nfiles that git cares about, except the ones that I put there manually\nand not from this tarball.\" If you guess that dot-files are manual and\neverything else isn't, then that is easy, but not necessarily right.\n\nIf you tagged the last import, you use \"git ls-tree\" to get you the list\nof files just from the tarball.\n\n-Peff\n"}]}