Coder Social home page Coder Social logo

Comments (7)

cwgreene avatar cwgreene commented on May 22, 2024

The author has proposed "a commit specifies the entire state of a repository, but is usually stored on disk as a set of changes" as an alternative. Does that sound reasonable?

from learngitbranching.

pcottle avatar pcottle commented on May 22, 2024

I'm assuming your the same commentator from HN -- thanks a ton for catching this. I'll paste my reply below:

"Thanks a ton for catching this. I guess there is a distinction to be made -- the compression might use delta's, but a commit specifies the entire state of the repository.
It's a tricky line to walk though, because commands like "git show" and "git patch" clearly show the delta-like nature of a single commit. I also don't want newcomers to think that commits are heavy and should be used sparingly.
I'm totally down to discuss this on a github issue with you, we could go over the wording. Maybe something like "a commit specifies the entire state of a repository, but is usually stored on disk as a set of changes"?"

Does that wording work? Here's a draft:


A commit in git specifies the state of the repository. This state encodes what each file looks like, so you can think of it as a snapshot of everything you're working on.

Git wants to keep commits as lightweight as possible though, so it doesn't just copy the entire directory every time you commit. It actually stores each commit as a set of changes, or a "delta", from one version of the repository to the next.

In order to clone a repository, you have to unpack or "resolve" all these deltas. That's why you might see the command line output:

resolving deltas

when cloning a repo.

It's a tricky concept, but for now you can think of commits as snapshots of the directory that are stored as deltas. Combining all the deltas together inside an empty folder gives you the full repository.

from learngitbranching.

cwgreene avatar cwgreene commented on May 22, 2024

It's not particularly important, but I'm the one from HN. :)

Your expanded draft looks fine (otac0n, if you can see any issues, let us know ), and is readable. I'll let you worry over how much you think needs to be explained up front :).

EDIT: I think the important thing is to get across the idea (which you do in the revision) that a commit is a state of the repo, and git handles the storage of said states (and switching between them) efficiently by mostly just keeping track of changes. However, bear in mind that I'm unsure how much of this has to be done explicitly using 'git gc'.

from learngitbranching.

pcottle avatar pcottle commented on May 22, 2024

It's also a lot to digest on (literally) the first intro screen in the entire app. I wish we could do stepping stones but then you have to oversimplify either way

either way I changed the dialog for now, lets see how that goes

from learngitbranching.

pcottle avatar pcottle commented on May 22, 2024

Fixed in 168852b

from learngitbranching.

otac0n avatar otac0n commented on May 22, 2024

The thing us that it is USUALLY stored as a snapshot, not as a diff. (see
git-hash-object)

When .pack files are involved, it gets more complicated. However, in the
common case, both versions of the files are stored.
On Feb 16, 2013 3:04 PM, "Chris Greene" [email protected] wrote:

The author has proposed "a commit specifies the entire state of a
repository, but is usually stored on disk as a set of changes" as
alternative. Does that sound reasonable?


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-13676807.

from learngitbranching.

Cogito avatar Cogito commented on May 22, 2024

I followed up with issue #13 which is I hope a clearer, and correct, treatment of the commit data structure.

from learngitbranching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.