r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

2

u/Pollomonteros Apr 05 '22

Seems like Git uses "snapshots" to store the different changes in files, and I am wondering how is that different from just saving a copy of each file ? Like if I have 3 files and only 2 change in a version,how is that different from 1 of them remaining the same while the other two are deleted and replaced by the new versions ? I am aware that Git has an "history" of changes in each file,but how can it have such an history without running out of space in their servers ?

2

u/Gamithon24 Apr 05 '22 edited Apr 05 '22

I might be wrong about how this works but I'll give it a go.

Instead of saving:

Filev1:

"Hello"

Filev2:

"Hello"

"World"

Git saves:

Filev1:

+"Hello"

Filev2:

+"World"

Git just remembers the added or removed line. Saving the redundancy of saving an entire file each time.