Live data from Hacker News

Learn Git Branching

pcottle.github.com

21–30 of 144 posts

Re: Learn Git Branching

#21
post #19

very nice idea. when/if this supports git push i'll come back and play some more. i'm a total git noob, git makes me crazy and maybe this will help clarify things for me.

I suggest you take the time to learn the "core" before memorizing all the commands.. everything will be so much easier : )

Re: Learn Git Branching

#22

Earlier quoted context omitted.

I didn't even realise you could type "help". There definitely needs to be some sort of introduction prompt otherwise people (like me) are just gonna leave feeling like they've learned nothing. Still, nice idea.

Agreed. I'm like you and I was just committing, branching, and merging but learning nothing while clicking around. I'm glad I know now though because I can totally use a lesson on branching. I think branching in Git is one of the most misunderstood parts of Git. I can't tell you how many times I've almost screwed up a repo because I made some mistake merging branches and not pulling from the correct branch when worki…

The implementation of branching in git is so fantastically simple (its literally a commit hash in a file, `cat .git/refs/heads/master` if you don't believe me) that it boggles the mind that so many developers have so much issue with it.

Re: Learn Git Branching

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

Re: Learn Git Branching

#25

Excellent work! I've wanted an easy way to explain git branching to people and from now on I'll point them to this.

Same! Sometimes I would like to introduce my coworkers to the amazing world of git, but it's hard to convince them without showing them a concrete example, this one is a pretty nice overview, and also useful for advanced users! I just got a better, more intuitive understanding of what detached HEAD really means thanks to it!

Git is amazing, I just wish if there was a better conflict resolving approach in Git.

Re: Learn Git Branching

#26
What is the difference between doing:

     git checkout -b bugFix
     git commit
     git checkout master
     git commit
     git merge bugFix master
And

     git branch bugFix
     git commit
     git checkout master
     git commit
     git merge bugFix master

Re: Learn Git Branching

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

- I made heavy use of javascript "Promises" to route control through the entire app. The source code has some nice examples, but it would be callback spaghetti without it

- You can import and export trees to share with your friends ("import tree" and "export tree" commands)

- You can build levels from within the app with "build level". The intro diaog should step you through the process

- It even supports interactive rebasing! Try it out with "git rebase -i HEAD~3"

Git is a fairly complex too that can be explained really well graphically. I never understood what I was doing until I saw diagrams in the git manpages and various books around on the internet. I wanted there to be an interactive form of these diagrams but it didn't exist --- so I built it.

9,000 lines of JS later I have this. There's still some polishing to be done, but I'd love for the community to share their knowledge about different git workflows and different ways to explain git concepts.

I tried to make the bar for contributing as low as possible. You can build a level and submit a pull request without even cloning the repo!

Re: Learn Git Branching

#28
post #2

It would be great if the help page popped up when I first load the site, so I don't have to guess and type "help" at the prompt to find out the purpose of the site. :)

My bad (author here), this was submitted without my knowledge :P The demo here:

http://pcottle.github.com/learnGitBranching/?demo

Shows the help page, an example level, and the whole shebang

Re: Learn Git Branching

#29

What is the difference between doing: git checkout -b bugFix git commit git checkout master git commit git merge bugFix master And git branch bugFix git commit git checkout master git commit git merge bugFix master

Creating a branch with

  git branch bugFix
does not automatically check it out, so you'd have to follow it up with

  git checkout bugFix
but if you do

  git checkout -b bugFix
it will create the branch and then check it out all in one step.

Re: Learn Git Branching

#30
shameless plug: www.srctree.net - Ace editor + git + canvas for viewing commits/branches.

I built it about a year ago, mostly for learning and fun. I haven't advertised it a lot but it seems relevant in here. I hope it's not off topic!

Post reply on HN