Re: Adding a new file as if it had existed

5 messages, 5 authors, 2016-08-11 · open the first message on its own page

Re: Adding a new file as if it had existed

From: Junio C Hamano <hidden>
Date: 2016-08-11 20:12:59

"Bahadir Balban" [off-list ref] writes:
Is there a good way of adding new files to git as if they had existed
from the initial commit (or even better, since a particular commit)?
This way I would only track the new changes I made to an existing
file.
No.

I do not understand why not adding all the files you care about
eventually anyway in the initial commit is needed for
"performance reasons", if you do not touch majority of them for
a long time.  Care to explain?

Re: Adding a new file as if it had existed

From: Johannes Schindelin <hidden>
Date: 2016-08-11 19:28:11

Hi,

On Tue, 12 Dec 2006, Bahadir Balban wrote:
On 12/12/06, Junio C Hamano [off-list ref] wrote:
quoted
No.

I do not understand why not adding all the files you care about
eventually anyway in the initial commit is needed for
"performance reasons", if you do not touch majority of them for
a long time.  Care to explain?
If I don't know which files I may be touching in the future for
implementing some feature,
When I use an SCM, it is to track the revisions of a project. It seems you 
are content to have only parts of a revision? That does not make sense to 
me.
I said "performance reasons" assuming all the file hashes need checked 
for every commit -a to see if they're changed, but I just tried on a 
PIII and it seems not so slow.
Bingo!

You just felt the consequences of the "index".

Ciao,
Dscho

Re: Adding a new file as if it had existed

From: Andy Parkins <hidden>
Date: 2016-08-11 19:41:08

On Tuesday 2006 December 12 11:32, Bahadir Balban wrote:
If I don't know which files I may be touching in the future for
implementing some feature, then I am obliged to add all the files even
if they are irrelevant. I said "performance reasons" assuming all the
file hashes need checked for every commit -a to see if they're
changed, but I just tried on a PIII and it seems not so slow.
Here's a handy rule of thumb I've learned in my use of git:

 "git is fast.  Really fast."

That'll hold you in good stead.  In my experience there is no operation in git 
that is slow.  I've got some trees that are for embedded work and hold the 
whole linux kernel, often more than once.  Subversion, which I used 
previously, took literally hours to import the whole tree.  Git takes 
minutes.

As to your direct concern: git doesn't hash every file at every commit.  There 
is no need.  git has an "index" that is used to prepare a commit; at the time 
you do the actual commit, git already knows which files are being checked in.  
Obviously, Linus uses git for managing the linux kernel, he's said before 
that he wanted a version control system that can do multiple commits /per 
second/.  git can do that.

In short - don't worry about making life easy for git - it's a workhorse and 
does a grand job.


Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE

Re: Adding a new file as if it had existed

From: Bahadir Balban <hidden>
Date: 2016-08-11 19:57:22

On 12/12/06, Junio C Hamano [off-list ref] wrote:
No.

I do not understand why not adding all the files you care about
eventually anyway in the initial commit is needed for
"performance reasons", if you do not touch majority of them for
a long time.  Care to explain?
If I don't know which files I may be touching in the future for
implementing some feature, then I am obliged to add all the files even
if they are irrelevant. I said "performance reasons" assuming all the
file hashes need checked for every commit -a to see if they're
changed, but I just tried on a PIII and it seems not so slow.

Re: Adding a new file as if it had existed

From: Andreas Ericsson <hidden>
Date: 2016-08-11 20:09:17

Andy Parkins wrote:
On Tuesday 2006 December 12 11:32, Bahadir Balban wrote:
quoted
If I don't know which files I may be touching in the future for
implementing some feature, then I am obliged to add all the files even
if they are irrelevant. I said "performance reasons" assuming all the
file hashes need checked for every commit -a to see if they're
changed, but I just tried on a PIII and it seems not so slow.
Here's a handy rule of thumb I've learned in my use of git:

 "git is fast.  Really fast."
Almost alarmingly so. When I started using git (back in May/June last 
year, when git was 2 - 3 months old), I was worried at first because it 
didn't seem to actually *do* anything, but just returned me to the 
prompt immediately.
As to your direct concern: git doesn't hash every file at every commit.  There 
is no need.  git has an "index" that is used to prepare a commit; at the time 
you do the actual commit, git already knows which files are being checked in.  

In short - don't worry about making life easy for git - it's a workhorse and 
does a grand job.
Yup. Now I've gone the other way around and think other scm's are broken 
when they chew disk for 10 seconds whenever I try to do anything with 
them. I usually end up importing the other repo into git and do my work 
there.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help