| This tutorial is great, but it propagates a misconception about git. "A commit in git is a recorded set of changes that you have made" Git commits are _not_ deltas. They are entire snapshots of the repository and a single (optional) pointer to an ancestor commit[1]. Git may handle _compression_ in terms of deltas (see 'Packfiles' in [2]), but logically, a commit should be thought of as equivalent to the state of all files that are being tracked. That difference is that if you were only looking at diffs, commits would be the _edges_ of a graph, rather than a node plus a single edge. This is why rebases change the commit SHAs but not merges (and why merges create a new commit). This is why if you are on a merge branch, 'git checkout HEAD~3' may not bring you to where 'git log' would naively suggest. Version control systems that actually do think of 'commits' as pure 'deltas' are ones such as darcs. A really good, low level explanation, of git is here http://git-scm.com/book/en/Git-Internals-Git-Objects (BUG REPORT) The commit created with 'git merge b2' from branch b1 should have HEAD~1 point to the previous head of b1, not b2. (that said, this is a really cool thing. :) I look forward to the author adding support for conflict resolution. ) [1] http://git-scm.com/book/en/Git-Internals-Git-Objects#Commit-... [2] http://git-scm.com/book/en/Git-Internals-Packfiles |
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"?
EDIT: moving discussion to: https://github.com/pcottle/learnGitBranching/issues/6
EDIT: fixed in: https://github.com/pcottle/learnGitBranching/commit/168852b2...