Reputation: 16287
This part of the documentation:
http://git-scm.com/book/en/v2/Getting-Started-Git-Basics
describes how git stores a full snapshot of the full filesystem/repository for each commit instead of tracking file changes.
I understand the concept but would like to understand it by example. I have therefore created a dummy SVN repository containing 8 revisions/checkins.
Now in SVN I do a "Update item to revision". E.g revision 4:
What happens is that my local svn repository automatically updates to the content of revision 4 (deletes/adds local content)
To me that seems exactly what happens in Git when a previous commit is checked out - from the local filesystem perspective.
Am I missing something or does Git and SVN not behave in the same way when it comes to how files are changes on disk when checking out previous versions/revisions of the codebase?
Upvotes: 2
Views: 200
Reputation: 60295
What happens is that my local svn repository automatically updates to the content of revision 4 (deletes/adds local content)
To me that seems exactly what happens in Git when a previous commit is checked out - from the local filesystem perspective.
And that's correct, it's just that git's internals are simpler and more useful.
does Git and SVN not behave in the same way when it comes to how files are changes on disk
Also correct: while so far as anyone's worktree is concerned git and svn have the same fundamental job, to put the content of any version anyone ever told it to care about to a worktree and take in new versions to care about, git's internal model is that it stores the versions directly. Whenever the payoff for packing up new content for compression looks like it'll be gratifying its object-access layer will do that under the hood, but the actual content tracking and source control never see that.
Upvotes: 2
Reputation:
Git commit contains only changed/new files. Also it's linked to previous commit(s). That's how all other files can be found.
But old objects can be compressed in future for space optimization.
Upvotes: -1