Live data from Hacker News

Learn Git Branching

pcottle.github.com

51–60 of 144 posts

Re: Learn Git Branching

#51
post #15

Absolutely fantastic tutorial, but as most other people here have mentioned there should probably be some indication that you should type help to get started.

I just pushed the site live, so it starts off with a help dialog and links to the demo. Future visitors should hopefully get a better experience!

My apologies again -- I only noticed it was on HN when I got an email about it...

Re: Learn Git Branching

#52
post #24

I would try it out but, fullscreened, I get the message "That window size is not supported :-/" How about letting me worry about that and continue anyway? What is the worst that could happen, I have to use a scrollbar?

I support a fairly wide range of zoom levels... from +3 levels zoomed in to almost any level zoomed out. The main reason why I can't do more than 4 is the way canvas pixels interact with screen pixels and some of the text positioning logic. If you're at a normal zoom level and getting that message, certainly let me know -- the zoom level detection logic is a unfortunately pretty hacky.

Please improve the error message to at least tell me what window sizes and zoom levels are supported.

Re: Learn Git Branching

#53

Nice stuff. This kind of branching visualisation is highly useful. I'd like to work with that kind of interface. I suppose I should use gitk or something similar? How did you create the branch visualization? Did you use some sort of library for displaying and animating connected nodes, or is it all coded from scratch?

I had to code it all from scratch unfortunately :-/ I looked at d3.js, arbor.js, and a ton of other libraries but none of them supported the tree layout I had in mind. Apparently visual tree layouts are PhD dissertation topics so there's a wide variety out there

I think a lot of educational value is in the animations as well, so it made sense to roll my own. The majority of the code involves all the visual and GUI elements -- re-implementing git (ironically) wasn't too bad!

Re: Learn Git Branching

#54

Nice stuff. This kind of branching visualisation is highly useful. I'd like to work with that kind of interface. I suppose I should use gitk or something similar? How did you create the branch visualization? Did you use some sort of library for displaying and animating connected nodes, or is it all coded from scratch?

Looks like raphael

https://github.com/pcottle/learnGitBranching/tree/master/lib

Re: Learn Git Branching

#55
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

Re: Learn Git Branching

#57

Seems only Chrome exists as a browser. All others need not apply.

Should work on Firefox, Chrome, and Safari. Anything specific you are noticing in another browser?? I rely pretty heavily on the box model for layout, but if you look at the CSS I included almost every browser extension (even Opera)

For example the buttons does not work in the levels dialog. I would make a pull request if I could figure out how to build it with Grunt...

Re: Learn Git Branching

#58

Wow! Author here, did not expect this to get submitted to HN yet (was going to finish out a few more levels this weekend and clean everything up). Forgive the giant "TODO" in the help dialog The link everyone should see is the demo: http://pcottle.github.com/learnGitBranching/?demo That shows a few example commands, the completion of a level, and finishes with the help dialog. Some interesting technical highlights -…

Absolutely brilliant work. I would love to see this expand out into a key reference for git beyond just learning branching. One great feature would be to support "learning modules" where anyone making a git tutorial could define their own lesson modules. This would go a long way to help people learn all the cool features of git, which is very daunting.

Re: Learn Git Branching

#59

Wow! Author here, did not expect this to get submitted to HN yet (was going to finish out a few more levels this weekend and clean everything up). Forgive the giant "TODO" in the help dialog The link everyone should see is the demo: http://pcottle.github.com/learnGitBranching/?demo That shows a few example commands, the completion of a level, and finishes with the help dialog. Some interesting technical highlights -…

Thanks for all the hard work! As a git noob, this is extremely useful to me. Thanks again!

By the way, what are some recommended git GUIs for linux?

Re: Learn Git Branching

#60
This is great. Adding this to my list of resources for beginners. The ability to build levels, export trees, etc. makes it even better.
Post reply on HN