Git Magic
www-cs-students.stanford.edu
www-cs-students.stanford.edu
Personally, I find all these supposedly-helpful analogies useless and confusing. If I start to learn git, I would rather someone just tell me three things:
1. Git saves 'entire' snapshots of a directory on each commit. 2. Each commit resides in a graph and has a pointer to its parent 3. The only commit with more than one parent is a merge commit - which carries data on how to merge two previous commits.
The special treatment that you see when you "git show" a merge commit is computed by comparing the merge commit's tree to its parents' trees.
I'd also add a (4) to your list: a branch is a pointer (a "ref" in git jargon) to a commit that is updated to the most recent commit each time you create a new commit.
Oh, and maybe (5): HEAD is usually an indirect pointer to a commit via a ref, but can also point directly to a commit in which case it is a so-called detached HEAD.
There, reverting any such patch would simply delete your entry without any more question (unless of course you committed another patch on top of it to, say, correct spelling). I assume this is the kind of advantage you get from your hack?
Every time I've tried to explain this to someone who doesn't understand how gits content addressable data-store works, I've been met with disbelief or mockery. These days I just point people to the docs.
Git is rather well engineered for what it set out to do.
Anyway, if you really like this, you should consider getting a physical copy: http://www.amazon.com/Git-Magic-Ben-Lynn/dp/1451523343/
A request for v2 -- I'd like more on topic branches, and good git hygiene. I usually send people to your book, and in fact, I learned my first git from it.
In the end, though, it encourages using git as a sort of backup-and-restore system, which is not the best and highest use of git.
The best and highest use of git is going to involve rebasing, collecting up and properly naming your commits, and making CERTAIN that one commit does one atomic thing to your codebase.
This just wasn't that obvious to me from git magic, but I think in the end it's the best part of git as a whole. Once I get people to stop using git reset --hard, my next training task is usually what I just described.
So, you know, pretty please? :)
[1] git clone git://repo.or.cz/gitmagic.git [2] http://www.methods.co.nz/asciidoc/a2x.1.html
Git on MSys is an alternative requiring minimal runtime support, though a few of the commands need some work.
Need some work on what? I hate it when some statements are made without giving any explanation
Git may be disadvantaged more than other systems because single files are not tracked
Though I get what they are trying to tell here ( I know git to an extent), a newbie will definitely be lead down the wrong path with this line. I am doubting this entire thing has any magic at all.
Known issues -Some commands are not yet supported on Windows, namely: git archimport, git cvsexportcommit, git cvsimport, git cvsserver, git instaweb, git shell. -git and bash have serious problems with non-ASCII file names (Issue 80, 159)
There are other known issues, but I think those are the most important.
However, this is a pretty good narrative, and is filling in some blanks for me. For instance, the git whatchanged command was new to me.