News for hackers. Stuff that matters.
Re:A List Apart: Get started with Git by shubber on Tuesday November 02, 2010 @12:09PM (#1860999)
I'm really tired of Git standing in for "DVCS" - there are so many better options. Bazaar, Mecurial, Monotone, Fossil - check those out. The only win I see in git is the adoption rate. Which doesn't seem like a real win, just populist shackling.
Re:A List Apart: Get started with Git by mhd on Tuesday November 02, 2010 @12:52PM (#1861234)
Github.

Yes, a big factor of it is "populist shackling", too. But being popular doesn't just mean that a lot of other people use it, it also means that a lot of other people use it to share code with you. Which is an important step beyond the popularity fallacy.

Re:A List Apart: Get started with Git by apl on Tuesday November 02, 2010 @12:11PM (#1861008)
Would you mind explaining why Git is inferior?
Re:A List Apart: Get started with Git by shubber on Tuesday November 02, 2010 @12:42PM (#1861175)
A big problem with git is that the commits-and-branching model is poorly thought through. It's very easy to find yourself on no branch at all, for instance, or for a developer to believe they've committed work to a shared branch when in fact it's a private one (and therefore leave the rest of the team hanging.)

It's merging workflow is awful - I'm fine with correcting the odd whitespace-as-conflict, but I find the fact that git presents me with >>>>> eyebiting ====== conflict markers <<<<<< even when I'm using a merge tool difficult to excuse.

Most of all, more than once, git has completely eaten work, which hasn't happened to me with a VCS since the days of CVS and corrupted repos.

Frankly, I see two kinds of arguments in support of git: arguments that derive from the fact that it's a DVCS, and therefore apply to other (IMO better) tools, or "community acceptance" (a la github, Rails) which I find frustrating and circular. Oh, and it's somewhat faster for infrequent operations.

Re:A List Apart: Get started with Git by nuclear_eclipse on Tuesday November 02, 2010 @01:52PM (#1861494)
I actually find the way that Git handles branches/commits and the ability to check out an individual ref to be very well thought out and extremely useful.

Re "eating work", most of the commands that could potentially "eat work" are explicit about blowing things away, and is more a problem of not knowing what your tool is going to do. And Git will never "eat" anything that's actually been committed or stashed without you explicitly telling Git to drop that data.

`git help <command>` should be used liberally if you're not certain of what it's going to do. The documentation is extremely thorough.

Re:A List Apart: Get started with Git by trustfundbaby on Tuesday November 02, 2010 @02:29PM (#1861663)
> A big problem with git is that the commits-and-branching model is poorly thought through

Really? I think that is one of its strongest points. being able to switch branches by just going 'git checkout <branch>' and immediately having the entire file structure switched out to what's 'contained' in the new branch was a big win for me.

Git also alerts you when you've made changes and are switching branches, so you can commit or stash your changes to the branch you were on and not mix it up with the new branch, unless thats what you really want to do.

> It's very easy to find yourself on no branch at all

Interesting. In what situation would that happen? I always thought you had to be on some sort of branch (master) at least to use git.

> It's merging workflow is awful - I'm fine with correcting the odd whitespace-as-conflict, but I find the fact that git presents me with >>>>> eyebiting ====== conflict markers <<<<<< even when I'm using a merge tool difficult to excuse.

Sounds like we're complaing about a cosmetic issue.

> Frankly, I see two kinds of arguments in support of git:

How about the fact that its branching model is pretty awesome and it gives you the tools to do exactly what you want with your version control (rebase, amending commit histories etc)?

Re:A List Apart: Get started with Git by shubber on Tuesday November 02, 2010 @06:16PM (#1862633)
"Really? I think that is one of its strongest points. being able to switch branches by just going 'git checkout <branch>' and immediately having the entire file structure switched out to what's 'contained' in the new branch was a big win for me. Git also alerts you when you've made changes and are switching branches, so you can commit or stash your changes to the branch you were on and not mix it up with the new branch, unless thats what you really want to do."

Cheap branching is a fantastic feature - that all the open DVCS tools have.

Git focuses on the ability of developers to edit their revision history and provide lovely linear histories (hence the existence of stash, rebase, et al). Git as a tool and as a community encourages one to do so - but the result can be that your local repo and my local repo can no longer be synchronized. Furthermore, it's easy to create a commit of inconsistent code - since you can commit file changes in separate commits.

Ultimately git simplifies the work of project maintainers at the expense of day-to-day development, which isn't surprising given it's source, but I think it's a bad trade.

Re:A List Apart: Get started with Git by jrockway on Tuesday November 02, 2010 @08:00PM (#1862963)
the result can be that your local repo and my local repo can no longer be synchronized

Nope. All rebase operations create a brand new branch and merely repoint a ref at it. The original pre-rebase branch is still untouched, and "git reset HEAD@{0}" (see: git-reflog) will reverse the effects of any rebase (and of course, you can undo the undo). Rebase does not affect synchronization in any way except that two users may have very different commit histories that they both call "master". Git handles the synchronization fine, however, so this is a social issue rather than a technical issue. I regularly work on large projects with many committers that rebase, and I have never had any difficulty. Hell, git pull even defaults to "git pull --rebase" now, so you probably won't even see any merge commits when you pull from someone's rebased branch now.

Ultimately git simplifies the work of project maintainers at the expense of day-to-day development

I disagree again. Git makes both day-to-day work easy, and it makes maintaining the project easy. When you are in hacking mode, you just commit with a short message whenever you feel like it. Commit freely, branch freely, merge freely, undo freely. When you are done and you want to cleanup your work to share, you can quickly split commits, combine commits, reorder commits, add better commit messages, and so on. Then, you can push to a public repository, ask someone to pull your branch, or just email patches around. If you mess it up somewhere, everything is undoable. Git even has tools to make merge conflicts easy to handle; if it sees a conflict you've manually repaired before, it can automatically try that repair without bothering you again.

Anyway, it's clear that some people take issue with people "rewriting history" and that they will never use git. But I take issue with having to maintain projects that have an incomprehensible (but "historically accurate" in the sense that I know exactly what the state was when some random person on the Internet typed "commit") history, and so I use git. It is the most efficient use of my time and mental energy, and is why its become so popular.

Re:A List Apart: Get started with Git by eru on Tuesday November 02, 2010 @07:41PM (#1862922)
> Furthermore, it's easy to create a commit of inconsistent code - since you can commit file changes in separate commits.

Actually, that's a feature. You can make finer grained commits this way. Use rebasing (or amending a commit, when you are just putting in the second commit) to make your changes atomic, when they need to be atomic.

Your repository isn't always in a consistent state. There's value in keeping inconsistent in between states---and git allows you to do that, but also allows you to clean up, after you're finished.

(Of course this creates an alternate history.)

Re:A List Apart: Get started with Git by eru on Tuesday November 02, 2010 @07:39PM (#1862916)
>> It's very easy to find yourself on no branch at all > Interesting. In what situation would that happen? I always thought you had to be on some sort of branch (master) at least to use git.

If you check out a revision, and not a branch, you will be on "no branch at all". But you asked for it, then.

Re:A List Apart: Get started with Git by jrockway on Tuesday November 02, 2010 @07:52PM (#1862947)
And of course, you can still commit there and give it a name later. Hack, then cleanup. That's the git model.
Re:A List Apart: Get started with Git by IdahoEv on Thursday November 04, 2010 @05:46PM (#1870946)
I figured this out eventually. However, when I first switched to git (and before I had tools to show my branch in my prompt), I managed more than once to make 3-4 commits on a detached head, and finding out how to fix that between the documentation and/or Google was essentially impossible. Once I simply gave up and re-did the work. The other time I figured out how to fix it, at the cost of about 3 hours of research and (eventually) questions on the IRC channel.

It's a powerful tool, and the docs are fine if you are an expert who already knows what you're looking for. I'll submit that it can be incredibly hard for a noob to learn to use correctly.

Re:A List Apart: Get started with Git by eru on Tuesday November 02, 2010 @09:06PM (#1863149)
Just don't do a GC, while you have dangling commits.
Re:A List Apart: Get started with Git by jrockway on Tuesday November 02, 2010 @09:33PM (#1863226)
You're fine as long as the detached head is newer than two weeks old. (And you might be fine past that point. While the branch is "unnamed" it does have a ref in the reflog pointing at it.)
Re:A List Apart: Get started with Git by fr0sty on Tuesday November 02, 2010 @05:30PM (#1862445)
> Most of all, more than once, git has completely eaten work...

Can you provide any specifics about this? My understanding (and experience) is that git makes it rather difficult to actually lose work. It may be easy to misplace, but never lose.

Re:A List Apart: Get started with Git by jshen on Tuesday November 02, 2010 @03:42PM (#1861983)
"A big problem with git is that the commits-and-branching model is poorly thought through. It's very easy to find yourself on no branch at all, for instance, or for a developer to believe they've committed work to a shared branch when in fact it's a private one (and therefore leave the rest of the team hanging.)"

I don't think you understand how git works. Calling it "poorly thought through" when you haven't taken the time to understand it is not a compelling argument.

"It's very easy to find yourself on no branch at all"

A branch is simply a pointer to a specific commit. If you checkout a random commit it is likely not a branch. I don't know why you find this troubling.

"It's very easy ... for a developer to believe they've committed work to a shared branch when in fact it's a private one"

Again, this is from a lack of understanding. All commits are to your local repository. It seems you haven't tried very hard to understand how git works.

Re:A List Apart: Get started with Git by bokchoi on Tuesday November 02, 2010 @04:20PM (#1862162)
Calling it "poorly thought through" when you haven't taken the time to understand it is not a compelling argument.

Neither is saying the OP hasn't taken the time to understand it.

Re:A List Apart: Get started with Git by jshen on Tuesday November 02, 2010 @05:23PM (#1862413)
I don't understand what your saying. I said that the OP doesn't understand git basics, and that a critique based on a lack of understanding is not compelling.

Are you suggesting that I'm wrong about his level of understanding or that one can make a valid critique of something they don't understand?

Re:A List Apart: Get started with Git by bokchoi on Tuesday November 02, 2010 @05:39PM (#1862486)
I'm saying that perhaps his level of understanding is not to blame. Most responses to complaints about git are "you just don't understand." It is tiring.
Re:A List Apart: Get started with Git by jshen on Tuesday November 02, 2010 @06:23PM (#1862661)
I went into barnes and noble one day and picked up the Pro Git book and sat in the cafe and read it for a few hours. After that I understood git fairly well and the things the OP said show that he hasn't put forth this minimal amount of effort. I don't think a few hours of study for a power tool is too much to ask, and I think it's reasonable to dismiss the arguments of someone who clearly hasn't put forth a sincere effort to understand it.

Also, the book is available for free online http://progit.org/book/

Re:A List Apart: Get started with Git by alinajaf on Tuesday November 02, 2010 @06:08PM (#1862597)
It may be tiring, but it's still true. "[svn|rails|regex|whatever] is bad because I don't get it" is not an argument, just an expression of laziness/lack of interest.
Re:A List Apart: Get started with Git by eru on Tuesday November 02, 2010 @07:37PM (#1862911)
> It's merging workflow is awful - I'm fine with correcting the odd whitespace-as-conflict, but I find the fact that git presents me with >>>>> eyebiting ====== conflict markers <<<<<< even when I'm using a merge tool difficult to excuse.

You might want to customize merge.conflictstyle

I do like the default of git however, and prefer it to, say, Mercurial.

Re:A List Apart: Get started with Git by generalk on Tuesday November 02, 2010 @03:40PM (#1861971)
It's very easy to find yourself on no branch at all, for instance, or for a developer to believe they've committed work to a shared branch when in fact it's a private one (and therefore leave the rest of the team hanging.)

I've never ever found myself on "no branch", and in cases where I've commited a bunch of code to a non-shared branch, I can easily push my branch to origin and make it shared.

Frankly, I see two kinds of arguments in support of git: arguments that derive from the fact that it's a DVCS, and therefore apply to other (IMO better) tools, or "community acceptance" (a la github, Rails) which I find frustrating and circular.

I use Git for exactly those reasons. Why wouldn't I use the DVCS the rest of the community uses? Why would I use, for example, Mercurial or Fossil over git? I think you missed the third argument in support of Git: "I like it and it works well for what I do."

Re:A List Apart: Get started with Git by ollysb on Tuesday November 02, 2010 @05:05PM (#1862344)
Merging and rebasing both put you into a "no branch" when you have merge conflicts. I've introduced a lot of people to git and this is an area that has consistently confused people. For instance there's nothing to stop you doing a commit where you should be doing a rebase --continue.
Re:A List Apart: Get started with Git by expeditious on Tuesday November 02, 2010 @12:40PM (#1861162)
A complaint I regularly hear is that it's user interface is frought with peril (and has some poorly-chosen defaults).
Re:A List Apart: Get started with Git by nuclear_eclipse on Tuesday November 02, 2010 @01:56PM (#1861509)
"Poorly chosen defaults" is also a synonym for "doesn't work like SVN/HG/BZR".
Re:A List Apart: Get started with Git by expeditious on Tuesday November 02, 2010 @02:13PM (#1861596)
I'd suggest that well-chosen defaults means: Make a pretty good guess at the most common usage patterns you expect most of your users to follow, and have your defaults do that by default.

I can't comment on whether or not svn/hg/bzr/git/darcs have well-chosen defaults. I only know that I hear it's a common complaint about git.

Re:A List Apart: Get started with Git by jrockway on Tuesday November 02, 2010 @07:52PM (#1862951)
I've used git since the early days, and I have trouble using svn and p4 now. Subversion and Perforce should choose better defaults.
Re:A List Apart: Get started with Git by __david__ on Tuesday November 02, 2010 @04:57PM (#1862316)
You are wrong. I've used most of those and, while on the surface they may appear to be equivalent to git, none of them comes close to having its feature set. Git is popular for a reason--it is complicated, but amazingly powerful.

The only non-git DVCS I'd even consider or recommend is darcs--its model is different enough to make it much better for certain workflows than git. It is also incredibly easy to understand and dead simple to use.

Re:A List Apart: Get started with Git by eru on Tuesday November 02, 2010 @05:23PM (#1862412)
Mercurial is actually more or less equivalent to git. You just need to activate some plugins for, say, rebasing. (I do prefer git, though, for religious reasons.)

I've tried using darcs a few years ago (it was my first DVCS system, actually). Did they fix the exponential runtimes one got occasionally? If yes, I'd probably give it another go.

Re:A List Apart: Get started with Git by shubber on Tuesday November 02, 2010 @06:03PM (#1862581)
It may have improved a lot recently, but the one project I was using Darcs on had this workflow:

1. Pull revisions 2. Discover local workspace was corrupted. 3. Delete local workspace and restart.

I'm not a fan of Darcs either. :)

Re:A List Apart: Get started with Git by __david__ on Tuesday November 02, 2010 @07:32PM (#1862894)
Corrupted how? (the repo data in the _darcs/ dir, or your local working copy?) I've used darcs extensively for years and have never experienced this.
Re:A List Apart: Get started with Git by ryanpetrich on Tuesday November 02, 2010 @07:44PM (#1862933)
The return of SourceSafe.
Re:A List Apart: Get started with Git by __david__ on Tuesday November 02, 2010 @05:33PM (#1862462)
Yes, darcs 2.0 fixed it or at least drastically minimized it. The problems occurred when there were lots of conflicts between patches. If you try to minimize conflicts (getting often, amending conflicting patches before pushing them) then you'll never run into the problem, even with the old darcs.
Re:A List Apart: Get started with Git by eru on Tuesday November 02, 2010 @12:20PM (#1861059)
There are other options. Most of the distributed version control systems are good. What's better seems to be a matter of taste now.
Re:A List Apart: Get started with Git by yatsyk on Tuesday November 02, 2010 @12:25PM (#1861091)
The only one drawback of git I know is not so good support of windows OSes. What are the other issues?
Re:A List Apart: Get started with Git by ben_straub on Tuesday November 02, 2010 @01:27PM (#1861375)
As a Windows git user, this is a minor concern. msysgit works from cmd, powershell, and the include bash prompt, and the gitk and "git gui" tools are actually pretty good once you're familiar with the metaphors.

The one thing that still gives me the heebies is the CRLF handling, but I think that's because rails generates unix-style files, and I get a warning from git gui whenever I use those scripts.

Re:A List Apart: Get started with Git by trustfundbaby on Tuesday November 02, 2010 @02:32PM (#1861683)
> and the gitk and "git gui" tools are actually pretty good

Not to mention tortoise git http://code.google.com/p/tortoisegit/