Git development
 help / color / mirror / Atom feed
* How does Git know which files no longer needed during upgrade?
@ 2009-03-03 21:51 dealmaker
  2009-03-03 23:30 ` Miklos Vajna
  0 siblings, 1 reply; 5+ messages in thread
From: dealmaker @ 2009-03-03 21:51 UTC (permalink / raw)
  To: git


Hi,
  I am going to upgrade software to a newer version in my main trunk, I
decide to download the newer version and checkout the main trunk and  copy
it over to my main trunk.  If the older version has some files that are no
longer in the newer version, how does git determine whether to keep those
files or not?  Does it even notify me that those files are no longer needed?
Thanks.
-- 
View this message in context: http://www.nabble.com/How-does-Git-know-which-files-no-longer-needed-during-upgrade--tp22318714p22318714.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How does Git know which files no longer needed during upgrade?
  2009-03-03 21:51 How does Git know which files no longer needed during upgrade? dealmaker
@ 2009-03-03 23:30 ` Miklos Vajna
  2009-03-04  9:49   ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Miklos Vajna @ 2009-03-03 23:30 UTC (permalink / raw)
  To: dealmaker; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 864 bytes --]

On Tue, Mar 03, 2009 at 01:51:14PM -0800, dealmaker <vinkhc@gmail.com> wrote:
>   I am going to upgrade software to a newer version in my main trunk, I
> decide to download the newer version and checkout the main trunk and  copy
> it over to my main trunk.

Do you mean the 'master' branch by 'main trunk'? Trunk is not in Git's
terminology.

> If the older version has some files that are no
> longer in the newer version, how does git determine whether to keep those
> files or not?  Does it even notify me that those files are no longer needed?

First, I think storing upstream code (that you will never touch) in
version control is a horrible idea, but if you really do it, I would do
something like:

cd /path/to/copy
rm -rf *
cp -a /path/to/new/version/* .
git add -A
git commit -m 'update foo to 2.0'

That will add/update/delete files as you would expect.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How does Git know which files no longer needed during upgrade?
  2009-03-03 23:30 ` Miklos Vajna
@ 2009-03-04  9:49   ` Jeff King
  2009-03-04 12:28     ` Stefan Näwe
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2009-03-04  9:49 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: dealmaker, git

On Wed, Mar 04, 2009 at 12:30:58AM +0100, Miklos Vajna wrote:

> First, I think storing upstream code (that you will never touch) in
> version control is a horrible idea, but if you really do it, I would do
> something like:
> 
> 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

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How does Git know which files no longer needed during upgrade?
  2009-03-04  9:49   ` Jeff King
@ 2009-03-04 12:28     ` Stefan Näwe
  2009-03-04 12:38       ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Näwe @ 2009-03-04 12:28 UTC (permalink / raw)
  To: git

Jeff King <peff <at> peff.net> writes:

> 
> > 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
> 
> -Peff

But maybe one wants to keep a .gitignore file. 

Regrads,
Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How does Git know which files no longer needed during upgrade?
  2009-03-04 12:28     ` Stefan Näwe
@ 2009-03-04 12:38       ` Jeff King
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff King @ 2009-03-04 12:38 UTC (permalink / raw)
  To: Stefan Näwe; +Cc: git

On Wed, Mar 04, 2009 at 12:28:07PM +0000, Stefan Näwe wrote:

> > > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-04 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03 21:51 How does Git know which files no longer needed during upgrade? dealmaker
2009-03-03 23:30 ` Miklos Vajna
2009-03-04  9:49   ` Jeff King
2009-03-04 12:28     ` Stefan Näwe
2009-03-04 12:38       ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox