How does Git know which files no longer needed during upgrade?
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.
Signature · 2 lines
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.
Quoted 3 lines · dealmaker
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.
Quoted 3 lines
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.
Quoted 9 lines · Miklos Vajna
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
Quoted 7 lines · Jeff King <peff <at> peff.net> writes:
Quoted 6 lines
cd /path/to/copy
rm -rf *
cp -a /path/to/new/version/* .
git add -A
git commit -m 'update foo to 2.0'
Quoted 6 lines
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
Quoted 6 lines · Stefan Näwe
Quoted 6 lines
Quoted 5 lines
cd /path/to/copy
rm -rf *
cp -a /path/to/new/version/* .
git add -A
git commit -m 'update foo to 2.0'
Quoted 6 lines
Quoted 4 lines
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