Live data from Hacker News

Still hatin' on git: now with added Actual Reasons

reprog.wordpress.com

31–40 of 169 posts

Re: Still hatin' on git: now with added Actual Reasons

#31
post #7

Duh. I've never got the hang of git either, but I figure git is for those people who don't get enough mileage out of Mercurial because they have 42 megatons of source code, or need git rebase, or just want to shock and awe their friends. But no need to hate git for that. No one's forcing you to use it. You don't like vim? Go ahead and use emacs/gedit/eclipse/perl. You don't like git? Use mercurial. Or subversion, if…

Mercurial also has had rebase built-in for some time. For git users who have compared both, what features made you choose git over hg?

Re: Still hatin' on git: now with added Actual Reasons

#32

Earlier quoted context omitted.

That doesn't work. The "git add README.md" completes with no output, but thereafter, "git commit README.md" still fails with "fatal: cannot do a partial commit during a merge."

just "git commit" after that, not "git commit README.md" edit: it's infuriating that yc won't let me reply to you, so I have to reply in this edit. Anyway. "git commit" says to git: "move anything in the index (i.e. things which I have 'git add'ed, or which have been merged) into the local repository". "git add FILE && git commit" says "put FILE in the index and then commit the whole index to the local repository" "g…

This is exactly the kind of unintuitive behavior that he was complaining about.

Re: Still hatin' on git: now with added Actual Reasons

#34

Earlier quoted context omitted.

just "git commit" after that, not "git commit README.md" edit: it's infuriating that yc won't let me reply to you, so I have to reply in this edit. Anyway. "git commit" says to git: "move anything in the index (i.e. things which I have 'git add'ed, or which have been merged) into the local repository". "git add FILE && git commit" says "put FILE in the index and then commit the whole index to the local repository" "g…

Oh! Well, thank you. Yes, I see that that works. But: (A) I see that it still commits everything, just like "commit -a", including all the files that I didn't change but that my colleague did in the branch that I'm pulling; and (B) Why would "git add FILE; git commit" but "git commit FILE" not work? I bet it's something to do with the index.

> (A) I see that it still commits everything, just like "commit -a", including all the files that I didn't change but that my colleague did in the branch that I'm pulling; and

'git commit' commits everything that is currently in the index. 'git commit -a' commits all files currently tracked by git in their current state (if the version in the index and in the working directory differ, IIRC, the version in the working directory is used). It's the equivalent of a "git add FILE" for all tracked files with outstanding changes, right before a 'git commit'.

> (B) Why would "git add FILE; git commit" but "git commit FILE" not work? I bet it's something to do with the index.

The index is meant to be the 'staging area' where you can pick and choose what you want to commit. See "git add -p FILE" for an example of more complex usage of the index than just picking and choosing which files to commit.

In general, think of 'git add' as your ability to promote changes from the working directory to the index, and 'git commit' as your ability to create a commit from the contents of the index.

Re: Still hatin' on git: now with added Actual Reasons

#36

Earlier quoted context omitted.

Nope.

see above, I edited to add what I'm talking about

My bad, I was wrong on this.

I would just delete my comment, but that would leave your replies looking dumb. Instead, feel free to downvote my earlier "Nope." into oblivion.

Re: Still hatin' on git: now with added Actual Reasons

#37
post #11

I have read a fair amount of documentation on git. I still don't even know what most git commands do. When people recommend a rebase, I pretty much just pretend that my repository isn't going to die. I wince every time I have to revert a file, as "git checkout" is friendly but "git checkout " is destructive without warning. I once destroyed a number of local files (I don't remember how) that were thankfully still ope…

> I wince every time I have to revert a file, as "git checkout" is friendly but "git checkout " is destructive without warning.

From my point of view, that's like saying that 'rm -rf' is destructive 'without warning.' It does what it was meant to do, you can't expect everything to warn you all the time in an effort to save you from yourself. It would get really annoying, really fast if it asked you to confirm every time you performed an operation in git.

'git checkout ' == 'replace with the version of in the index' (if the index is empty, then index == HEAD)

I'm also unsure how 'svn checkout ' is less destructive.

[Note: Though these 'git debates' tend to get heated because you have "frustrated people that don't understand git but are trying to use it" on one side and "people that understand git and are frustrated at the 'ignorance of newbs'" on the other side, this is not an attack.]

Re: Still hatin' on git: now with added Actual Reasons

#38
post #24

Earlier quoted context omitted.

"But no need to hate git for that. No one's forcing you to use it. You don't like vim? Go ahead and use emacs/gedit/eclipse/perl. You don't like git? Use mercurial" If only this were true. But it's not: if I work on a project where my colleagues keep the source in git, then I have to use git (whereas if they use vi, I am still at liberty to use emacs). That's the problem with CVSs -- they have a lot more inertia than…

I presume you haven't come across Hg-Git, then. http://hg-git.github.com/

I've seen things like this. I would be very wary about trusting them with my precious source code, wouldn't you? However good they are, they're an additional layer in which (A) things can go wrong, and (B) you're insulated from the reality that you need to access to fix problems.

I fear that Hg-Git would be one of those things that is an absolute delight for as long as it Just Works, then abruptly transitions into an absolute horror the moment something goes wrong.

Re: Still hatin' on git: now with added Actual Reasons

#39
I sort of take issue with this statement:

“git is bad for me because it makes assumptions about how I work that don’t match how I actually work”

I think that it's the other way around. git was built with a specific type of workflow in mind. If you take git and try to insert it into your current workflow with a minimal understand of git (or its intended workflow), then isn't it really you that are making assumptions about how the tool works, rather than the tool make assumptions about how you work?

{edit}

  - I make a one-line change to a single file.
  - I commit my change.
  - I git push, only to be told “! [rejected]	     master -> master (non-fast forward)”. 
    (This is git’s cuddly way of telling you to do a pull first.)
  - I git pull, only to be told
    “CONFLICT (content): Merge conflict in filename.
    Automatic merge failed; fix conflicts and then
    commit the result.”
This is because you've created your local tree as such:

   A-B-C
And the remote tree looks like:

  A-B-D
When you run a 'git pull' it's a combination of two operations:

  1. 'git fetch' or 'git remote update' which updates your local
     copy of the remote tree. This is stored locally in the branch
     / (e.g. origin/master).

  2. 'git merge  /' most
     of the time this merge is a fast-forward merge which you don't
     notice at all. It's when your local commit 'C' has conflict
     with remote commit 'D' that you run into an issue.
In the end your tree will look like:

   A-B--D--E
      \_C_/
Where E is a commit with that resolves the conflict and has two parent commit IDs which point at D and C. In general, you want to just avoid this kind of stuff in the first place by either using rebase or doing the 'git pull' before you commit you changes, then push them out.

[ I'm having a hard time picturing how you would have resolved this with SVN. If you have a conflict between a local file and an update that you are pulling down with 'svn up' what happens? (I've not used SVN extensively) ]

{edit}

> Well, darn. So, OK, no problem, I already fixed the conflict, so now I’ll just git merge again to get it to make its world consistent, right? Nope: “fatal: You have not concluded your merge. (MERGE_HEAD exists)”. Well, duh! I was telling you to merge, you stupid git. You’re the branches-and-merges-are-easy version-control system around here.

You're telling git to start a new merge, not complete an in-progress merge. Think of 'git merge' as 'create a commit that merges these two things together.' When you run into a conflict 'git merge' tells you, "Sorry I couldn't automatically resolve this for you, but I got you as far as I could go. You'll have to manually resolve these conflicts and create the merge commit." At this point your working directory is in a state of 'middle of a merge.' You just have to resolve the conflicts that were pointed out to you (adding them to the index once they are resolved), and run a 'git commit' to push out the merge commit.

Re: Still hatin' on git: now with added Actual Reasons

#40
post #25

Earlier quoted context omitted.

No, mercurial has exactly the same problem he mentioned: You want to push 'some' of your local uncommitted changes, but if the remote head has also changed you often can't. (hg shelve is a poor substitute). This happened to my team enough in practice that they rebelled and forced a switch back to SVN.

Looks to me like he had two problems. The first was that git gave very poor error messages and needed a confusing series of command-line options. In mercurial, this is much better; the pull creates a new head, and tells you what to do if you want to merge them. Commit is one-step, instead of via the staging area. It just gives more feedback, more usefully, and requires less knowledge about the underlying representati…

There's two problems with this approach:

1. If you have other uncomitted changes, you're simply hosed. You can't continue with the merge process with local changes at all.

2. It pollutes your change list with unrelated, unconflicted changes belonging to your teammate (the whole changeset).

Post reply on HN