Live data from Hacker News

Got 15 minutes and want to learn Git?

try.github.com

121–130 of 178 posts

Re: Got 15 minutes and want to learn Git?

#121

Earlier quoted context omitted.

> Why is there a staging area in the first place? Because you don't always want to commit every change you've made or every new file you've added. > If a commit doesn't push my changes to a remote repository, why do I care? If I have my code in a working state, I'd like to save that "version" somewhere, so I can make a whole bunch of changes without worrying about whether or not I can get back to a working state. Thi…

What disturbs me about that workflow is that your commits have literally never been tested because the staging area contents aren't accessible as a working copy. I for one am adamant about not littering my history with all my crap that didn't run, so I much prefer to commit the mixed work and then rewrite history to tease out and regress the independent changes. I pretty much always test and commit my workspace as-is…

> It'd be easier if I could stash some but not all of my changes to get them out of my workspace temporarily, but this hasn't bugged me enough to figure out how to implement that.

Here, let me help you, from the examples section of `git help stash`:

"Testing partial commits You can use git stash save --keep-index when you want to make two or more commits out of the changes in the work tree, and you want to test each change before committing:

               # ... hack hack hack ...
               $ git add --patch foo            # add just first part to the index
               $ git stash save --keep-index    # save all other changes to the stash
               $ edit/build/test first part
               $ git commit -m 'First part'     # commit fully tested change"
A nice thing about Git's Swiss army knife nature: someone else has likely run into most problems you encounter, and have added the solution to Git porcelain.

Re: Got 15 minutes and want to learn Git?

#122
post #91
post #86

Earlier quoted context omitted.

Learning everything about git is hard, but learning enough git to use personally isn't that hard. I use git personally to keep backups of my code and deploy sites I work on. I dont' work with other developers so my knowledge of git is workable, but probably super small. Git gets complicated (but probably extremely useful) when working with bigger groups and tons of commits, branches and merges.

I feel like there's not much point in any sort of VCS lesson if it doesn't go over the more complex areas though. For example, reverting commits and resetting to earlier points in history are pretty essential actions, but both have their subtleties in Git (e.g why reverting a merge is hard, what 'reset' vs 'checkout' do) that will bite you if you don't know what you're doing. And everyone's fucked up via git rebase a…

Sorry, maybe I've just been using Git for long enough not to remember the pain, but can you explain "why reverting a merge is hard"?

Yeah, the Git command `revert` has a bunch of kind of esoteric flags, but once you understand that it can stomp on your working dir and/or your index, it's not that hard to use. I don't know what about reverting to a point prior to a merge would be difficult, unless you are in the middle of a merge at the time. Again, sounds like most trouble is caused by not understanding how to use what is a relatively powerful piece of software.

No one is stopping you from using the built-in OS versioning, SVN or Dropbox. IMO that would be a nightmare for anything beyond the most simple cases.

Re: Got 15 minutes and want to learn Git?

#123
post #92

Earlier quoted context omitted.

There are a lot of cases even on bigger SW projects when for some roles(designers, tech writers) just basic git skills would save a lot of nerves to developers. Designers can fix small things, like images, tweak html a bit etc. They dont need to know how to create/merge new branches etc.. I dont see that Git is trying to pretend that its simple but i can see how that interactive tutorial can be incredible useful to a…

its great that Git wants to explain what it got to offer to me, but why on step #7 it is mandatory to create a new account?? this killed entire positive experience, in my view.

Github wants to explain what Git has to offer you. I assume they want to see you as a potential customer, and if nothing else it gives you a real live low-risk git repository to play with after you're done with the tutorial.

Re: Got 15 minutes and want to learn Git?

#124
post #30

NOTE: This is not a rant, I'm just trying to give you a peek into my mind as I tried out this tutorial. I'm doing my best to describe my confusion. I have no clue how to use Git, and I've been trying to wrap my head around it for a while. Unfortunately, this is yet another tutorial that is very frustrating even though it's designed to target noobs like myself. So, I added octocat.txt to my staging area. Success! ...…

In a nutshell... a project can be described in terms of the changes a user makes over time. In Git, these changes are called "commits". Commits contain a change a user has made to the code and some additional useful metadata. This metadata includes the time the change was made, the user's name, a message to describe in general terms what the change was (that -m thing), and so on. Git itself is a database that stores…

Again, this is a gross oversimplification that describes only generic version control concepts and none of the powerful features that .

Go ahead and try explaining a rebase without trying to broach the concepts of time travel. How about why having a local copy of all commits/branches/etc related to the repository is helpful, or even at all possible, without relating it to a simpler client/server version control system.

Re: Got 15 minutes and want to learn Git?

#125
post #3
post #2

I get an entirely blank page. JavaScript errors. Win 7, Opera 12.

Pssst, Linux+Chromium.

BTW, people aren't downvoting you because of your convictions as you seem to think according to your profile. They're downvoting you for a complete lack of contribution to the comment thread. That's why people downvote on Hacker News.

Re: Got 15 minutes and want to learn Git?

#126
post #30

NOTE: This is not a rant, I'm just trying to give you a peek into my mind as I tried out this tutorial. I'm doing my best to describe my confusion. I have no clue how to use Git, and I've been trying to wrap my head around it for a while. Unfortunately, this is yet another tutorial that is very frustrating even though it's designed to target noobs like myself. So, I added octocat.txt to my staging area. Success! ...…

Rather than these n00b tutorials, I recommend reading "Pro Git" by Scott Chacon, available for free here: http://git-scm.com/book

If you prefer a video, try "Getting Git" by Scott Chacon: http://vimeo.com/14629850

Coming from a Subversion & Perforce background, I was initially very confused by Git. There were two things that finally switched-on the old lightbulb for me:

a) Scott's book

b) Actively using Git for all of my personal projects (e.g. small school assignments and code experiments), without using a remote repository. If you defer learning about remote repositories for now, I'm sure the light will switch-on for you as well :)

Re: Got 15 minutes and want to learn Git?

#127
post #30

NOTE: This is not a rant, I'm just trying to give you a peek into my mind as I tried out this tutorial. I'm doing my best to describe my confusion. I have no clue how to use Git, and I've been trying to wrap my head around it for a while. Unfortunately, this is yet another tutorial that is very frustrating even though it's designed to target noobs like myself. So, I added octocat.txt to my staging area. Success! ...…

> Anyway, for some reason, everyone who tries to describe Git already has such a strong understanding of it and it's oddities, that they are, for some reason, unable to lay it out properly for a noob IMO

I for one had a really hard time grasping Git, until I wiped my VC-mindset slate clean, it was primarily my upbringing in a development environment where Centralized Version Control was the king. I read up on Eric Sink's Version Control By Example. It's a great book to lay-out the fundamentals of Git. If you wrap yourself around the concept and not the tool, the use of tools (Git commandlines, Git GUI's) will come naturally.

Re: Got 15 minutes and want to learn Git?

#129

Earlier quoted context omitted.

Everything you just said is exactly why Git is not simple and can not be learned in 15 minutes. Just by operating from the command line you've already left the realm of "simple" in my opinion. Having to learn 9 commands is not simple. Having to hit Google for help multiple times per week is not simple. I strongly, strongly disagree with your assertion that "for simple cases Git is really simple to use and to learn".…

> Just by operating from the command line you've already left the realm of "simple" in my opinion. Git is a tool for programmers. There's no excuse for a programmer to be uncomfortable with the command line.

I am a productive programmer and I am absolute uncomfortable with the command line. I can't count the times I have written

    svn commit -m "Finally fixed bug #123!"
...only to get some weird bizarro error because I should have used '' or escaped the !. This is usually when I am deeply focused on some programming language or bug #123.

Tower.app is the only reason I've ever touched git, and the line-by-line staging and committing is nothing I would ever bother to do with a CLI.

Re: Got 15 minutes and want to learn Git?

#130
post #100

Earlier quoted context omitted.

I haven't read any books or longer tutorials on Git. I find it easy to use and if I run into trouble I just Google after help (which happens a few times a week). Throughout the day I mostly use 9 Git commands. Here are the top 9 commands I use: git checkout X git checkout -b new-branch git commit git add; git mv; git rm; git pull --rebase git rebase origin/master git push origin X I have used this for a long time wit…

Everything you just said is exactly why Git is not simple and can not be learned in 15 minutes. Just by operating from the command line you've already left the realm of "simple" in my opinion. Having to learn 9 commands is not simple. Having to hit Google for help multiple times per week is not simple. I strongly, strongly disagree with your assertion that "for simple cases Git is really simple to use and to learn".…

Sorry, But how is that difficult.

Even the simplest form of source control involves checkout->change/add->commit->checkin. And this is regardless of any version control system you will ever use.

The only extra stuff there is branching and merging. And to be frank. I've never felt the individual need to do that. Its a different story if you have a big team and members working on several projects which merge at a time. Now that's difficult with any VCS, not just git.

But for individual development anybody should be able to do the checkout->add/change->commit>checkin easily.

Post reply on HN