Live data from Hacker News

Got 15 minutes and want to learn Git?

try.github.com

111–120 of 178 posts

Re: Got 15 minutes and want to learn Git?

#111
post #92

Can we please stop pretending that Git is simple and easy to learn? If that were true then there wouldn't be "Learn how to use Git in minutes!" posts every other day. The fact of the matter is that Git is incredibly powerful but also complex and hard to learn. This isn't a bash on Git at all. It's ok! Sometimes complicated things are just that, complicated. I believe we'll have better guides and tutorials if people s…

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.

Re: Got 15 minutes and want to learn Git?

#112
post #103

Earlier quoted context omitted.

I figured out Git, and I'm not that clever, so don't worry! The staging area (aka the index) is where you put things before they become a commit. You don't always want to commit all of your changes at once. The index is there so you can commit the changes you want instead of just committing all the changes every time. `git commit` means "turn the contents of the index into a commit". A commit is a set of changes that…

That doesn't explain the fundamental part. Why is there a staging area in the first place? Place yourself in the shoes of a subversion user, the workflow is very simple and intuitive given that: 1. the repository is a (remote) place where my project is stored 2. the local copy is where I modify my project Then, a commit is just pushing your modifications to the repository where other people can go get them. Now, with…

I use Git for just my own projects, and it's just me. I barely use branches either, and I come from SVN.

I use TortoiseSVN, I'm not sure if you do. But when I want to commit in SVN, I bring up the commit tool, select the files I want to commit, write a message in the box, and click commit. But I have to do it all in one go. I can't close the commit window if I forget something, otherwise I have to make sure I copy out the message to paste in again, select all the files.

With Git, the staging area is the same as this commit box. It's just a bit more stretched out. Instead of selecting files to commit, and doing it then, you add files to the staging, and commit the staging area. It's a different way of doing it, but I've found it much better for myself. Instead of doing it all in one go, I can add to staging and keep working. Usually I keep open all the files that have changed so I remember which ones to add.

Regarding the remote repository, you still can have it remote. Simply instead of "commit" being the last action you do to push it to the remote repo, make sure "git push" is. I use bitbucket for this, so I know it's "safe" in case of computer death or something.

I have one more project using SVN and I want to move it to Git, for just me, I don't work in a team or anything like that. I like the staging area, it feels "lighter" and that commits are much less drastic, and diffs/logs are MUCH faster since it's all on your computer. Also, `git add -p` to craft your own commits.

Re: Got 15 minutes and want to learn Git?

#114
post #103

Earlier quoted context omitted.

I figured out Git, and I'm not that clever, so don't worry! The staging area (aka the index) is where you put things before they become a commit. You don't always want to commit all of your changes at once. The index is there so you can commit the changes you want instead of just committing all the changes every time. `git commit` means "turn the contents of the index into a commit". A commit is a set of changes that…

That doesn't explain the fundamental part. Why is there a staging area in the first place? Place yourself in the shoes of a subversion user, the workflow is very simple and intuitive given that: 1. the repository is a (remote) place where my project is stored 2. the local copy is where I modify my project Then, a commit is just pushing your modifications to the repository where other people can go get them. Now, with…

> 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. This is true even if no one else in the world has to read my code. This is the entire rationale of version control in the first place! But if I can do it just on my own individual changes, that means I can go back to a closer savepoint and not have to play the whole level over again if I screw up ;)

> Well, if a commit allows me to have a local history of changes that I may not want to have in the remote repository, why do I need to stage my changes? Why don't I just commit them and be done with that? Isn't the files themselves a stagind area? Isn't this all redundant?

No, because you still don't always want to commit every change you've made or every new file you've added!

Maybe you want to commit while you have Vim open but you don't want to add a bunch of garbage .swp files to your repo. Maybe you did two or three different things that aren't related, so you want them to show up as two or three different commits in the history.

From the perspective of a Subversion or Perforce user, it's not something you really think about because it's not even an option that you have. You effectively don't even have version control on your own machine. Your company has version control, but you don't. And in my personal experience as a Subversion or Perforce user, I frequently feel lost at sea in that environment because it's virtually impossible for me to reliably do things like:

1. Get back to a working state newer than the one I checked out of the repository after making lots of changes everywhere.

2. Make completely unrelated code changes at the same time without mixing the changes together. Maybe one change is blocking on a code review. Maybe I found an unrelated bug and want to fix it separately from whatever other changes I'm making. Maybe I'm second-guessing a certain feature addition and want to put it on ice while I do other things. Maybe someone reported a bug and I want to fix it separately from what I happen to be working on at the time. Whatever the reason, it can live in its own branch and I can come back to it later. I don't have to create duplicate workspaces in my file system, Git just manages it for me.

3. Turn a large, complicated code change into a series of smaller changes, each with its own diff and description which I can review more easily.

These are things I do every day. I would do them if I shared my code with a small team or with the entire world. I would do them if I shared my code with no one at all. Git isn't just for large distributed projects. It's for decoupling version control from version sharing or version verification.

In practice, the purpose of something like Subversion or Perforce isn't to help you as a programmer, it's to help the canonical owner of the code you're working on to do certain things, like rollback to past versions or make policies that your code has to pass code review or something before you can "check it in". Git handles all that too--some of it more effectively--and it has the added feature that even you the programmer can get the benefits of version control, too.

> No tutorial that I can remember does this. Not a single one.

The purpose of a tutorial is to help someone learn how to use Git. If you're not interested in learning how to use Git, why are you reading tutorials? It would be much easier to just start a flame war on Hacker News and wait for someone knowledgable to respond. I guess you figured that out yourself.

Re: Got 15 minutes and want to learn Git?

#115
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".…

> 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.

Re: Got 15 minutes and want to learn Git?

#117
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".…

"Everything you just said is exactly why Git is not simple and can not be learned in 15 minutes. " haha agreed

"Just by operating from the command line you've already left the realm of "simple" in my opinion." It's all about the audience, people who are used to CLIs will find new CLIs that are similar to the ones they already know simple.

"I strongly, strongly disagree with your assertion that "for simple cases Git is really simple to use and to learn"

I've taught git to designers in 15 minutes and had them off and running for the next ~6 months. That said even after a few months of using it I still lack understanding of some of the core concepts.

Re: Got 15 minutes and want to learn Git?

#118
post #103

Earlier quoted context omitted.

That doesn't explain the fundamental part. Why is there a staging area in the first place? Place yourself in the shoes of a subversion user, the workflow is very simple and intuitive given that: 1. the repository is a (remote) place where my project is stored 2. the local copy is where I modify my project Then, a commit is just pushing your modifications to the repository where other people can go get them. Now, with…

> 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, treating the staging area as an unfortunately visible implementation detail. 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.

Re: Got 15 minutes and want to learn Git?

#119
post #35
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! ...…

The Pro Git book is relatively good. Ignore Chapter 1. http://git-scm.com/book/en/Git-Basics

This is probably one of the easier tutorials out there.
Post reply on HN