2 ms·
This post is almost impossible to understand if those concepts are truly new to you. The hard way is supposed to just dive in, not skip necessary bits. I unders
by lucb1e 9y ago
This post is almost impossible to understand if those concepts are truly new to you. The hard way is supposed to just dive in, not skip necessary bits. I understand it's a promotional piece for a book, but this makes me wonder whether the book is also like this (probably (hopefully?) not because there is more space).
- urda 9y agoThis feels more like an Ad than an article to be honest.
- iooi 9y agoMods, isn't it time you add something to the guidelines [1] to discourage advertisements disguised as articles? https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- lucb1e 9y agoI'm not sure about prohibiting it. I didn't really like the article, but if more people feel that way, the community just shouldn't upvote it -- or at least other, better things get more upvotes than this one. I feel like prohibition should be the last resort for things which the mods notice actively causing conflict among otherwise civil members of the community, like political discussions (e.g. there have been attempts at no politics days because of this, but that didn't work well for multiple reasons).
- maxdamantus 9y agoAnd even if the concepts are not new, the post seems very misleading. Something describing itself as teaching "the hard way" should certainly avoid fuzzy statements such as the following: > HEAD is a special reference that always points to where the git repository is. This kind of makes sense if you think about it a certain way (it generally points to something (possibly indirectly) that the index/working tree is based off), but off-hand, "where the git repository is" sounds like it means the location of the repository within the filesystem or something. > If you checked out a branch, it’s pointed to the last commit in that branch. If you checked out a specific commit, it’s pointed to that commit. This is inaccurate. When you check out a branch, HEAD points to the ref for the branch, which in turn usually points to a commit. > Every time you commit, the HEAD reference/pointer is moved from the old to the new commit. This is wrong unless you're in a "detached HEAD" state. `git commit` updates a ref that does not point to another ref. If you're in a "detached HEAD" state, that means HEAD is updated (since HEAD is pointing directly to a commit). If you've checked out a branch, that branch's ref will usually be updated (since HEAD is pointing to a ref which points directly to a commit). In my opinion, git is best described in terms of what is ACTUALLY happening in terms of modifications to the refs database (essentially a `Map FilePath (Either FilePath ObjectId)`), rather than trying to come up with metaphors for what it means to perform certain actions. When I say that "HEAD points to the ref for the branch", that is demonstrably exactly what happens: > $ cat .git/HEAD > ref: refs/heads/master > $ git checkout -b other-branch > $ cat .git/HEAD > ref: refs/heads/other-branch > $ git checkout --detach > ffd914475c61c18c684ccb0024ca141c54255e28 Understanding this basic concept should make most of the concepts explored in sections 1) and 2) of the article self-explanatory.