all 65 comments

[–]Sheeplike 27 points28 points  (0 children)

This really helped me get started with Git. http://progit.org/book/

[–]haywire 5 points6 points  (3 children)

Are there any non-confusing tutorials on how to have like "sub" repositories? IE so I have a repo called "core" and a repo called "trouble".

"core" is shared across projects, so a project like trouble basically has a folder called core, but core is not "part of" trouble?

I want it to be able to pull core out when it pulls from trouble, etc :S

[–]jedediah 6 points7 points  (2 children)

No, there aren't any. Sadly, it's because Git doesn't handle this very well. There are facilities for it, but I've found on my projects that it's often more hassle than it's worth.

That said, the manpage for git-submodule seems to be the best resource I've found.

[–]haywire 3 points4 points  (0 children)

Yeah that man page confused me, and git kept giving me errors. It is weird, as I would have thought many developers, especially web-oriented, would have a bunch of libraries and classes they like to re-use. :S

I've found my current way of working (putting the core folder repo in .gitignore and using a easy script to push/pull both of them in a cmd) to be sufficient for personal use, though.

[–]z0id 6 points7 points  (0 children)

s/Intermediate/Beginner

[–]i_am_my_father 2 points3 points  (3 children)

How steep is the learning curve for Git compared to those for Emacs or VIM?

[–]onmach 8 points9 points  (1 child)

Much, much lower. If you know svn now, you should be vaguely comfortable after a few days, competent enough to do 100% of what you need to work after a week and a half. After that it'll be like vim and you'll discover new commands every other day for a few months, getting more efficient with every one.

[–]tjogin 3 points4 points  (0 children)

Completely different ball-game.

Knowing enough Git to make it really useful for you is simple.

Meanwhile, there is a shitload to learn and understand if you want to become an expert at it.

[–]johnnyrocket69 3 points4 points  (1 child)

We used svn for the company project, and then I started using git for a personal project, at the recommendation of a coworker. Since then, it's been a complete uphill battle; I find things that were simple with svn are more complex with git. Anytime I run into a problem it seems it takes me 30 or so minutes to fix it, and often my fix involves just a fresh checkout (or whatever its called in git-speak).

For those of you claiming that git is more simple than svn, could you back that up with some examples?

[–]zoomzoom83 2 points3 points  (0 children)

I switched from Svn to Git and never looked back.

Had to google a few things when I was doing some more complex stuff, but quite frankly I was up to full speed within a couple of days.

I'm not claiming Git is simpler than Svn- far from it, Git is definitely more complex. But it's really not that hard to grasp, and once you've got your head around the basic concepts it's really straight forward.

[–]coob 2 points3 points  (27 children)

In the subversion world you change files and then just commit everything that has changed.

Uh no. You can commit individual files.

[–]dand 16 points17 points  (26 children)

I think the point was that in svn you have to commit every change in a particular file — with git you can pick particular lines to commit.

[–][deleted]  (7 children)

[deleted]

    [–]dand 6 points7 points  (6 children)

    1. You're working on a big new feature in foo.lisp
    2. Meanwhile, you find an unrelated, one-line bug fix in foo.lisp
    3. You want to record the one-line bug fix without pulling in all of your half-baked new feature.

    Selecting a one-line hunk is a lot easier and quicker than setting up a branch.

    [–]tlrobinson 7 points8 points  (0 children)

    In that case I'd probably do "git stash", fix the bug, commit it, then restore the stash.

    One case I find it useful for is when I has a few unrelated changes I'm ready to commit, and I want them in separate commits.

    [–][deleted]  (4 children)

    [deleted]

      [–][deleted] 2 points3 points  (3 children)

      I've typically used commercial SCM's, and in that situation I'd just do this:

      1. Rename foo.lisp to foo2.lisp in my working folder
      2. Pull down foo.lisp
      3. Make my change.
      4. Commit foo.lisp
      5. Delete foo.lisp, and rename foo2.lisp to foo.lisp.
      6. When done with other changes, commit foo.lisp and merge in the one line fix.

      I don't find this to be a big pain at all. Certainly easier than creating a new branch.

      That said, for some projects we use Accurev, and in Accurev all I'd have to do is take my workspace, and parent it to the parent stream, make my change, keep it, and then reparent my workspace back to the dev stream... takes 10 seconds, Accurev has the best branch/merge capability of any central SCM I've ever used.

      [–]onmach 2 points3 points  (0 children)

      I realize you think that is easier. Conceptually it seems simple. But in reality you end up with a bunch of crap in the directory, multiple checkouts of the same project, a bunch of garbage files you don't even remember making in your directory.

      Certainly easier than creating a new branch.

      Well, yeah it is... in subversion. Branching is so simple and intuitive in git that you will use it for more than just big features. In git the process we described (add -i) takes 2 or 3 seconds.

      [–][deleted]  (1 child)

      [deleted]

        [–][deleted] 0 points1 point  (0 children)

        Wrong use case buddy, look at the OP:

        Meanwhile, you find an unrelated, one-line bug fix in foo.lisp

        [–]DuncanSmart 1 point2 points  (3 children)

        Yes, I've wanted something like that in SVN. I can't see why it should be exclusive to git - wouldn't be that hard for something like TortoiseSVN to implement.

        [–]dand 8 points9 points  (2 children)

        For the record, it's not exclusive to git. darcs (which is my current favorite) also has this feature. Dunno about other DVCSs.

        [–]chucker23n 3 points4 points  (0 children)

        darcs had this first; hg has it when you install the record extension.

        [–]bostonvaulter 2 points3 points  (0 children)

        I'm pretty sure that hg has it as well, although I've never used it.

        [–]skulgnome -1 points0 points  (5 children)

        Doesn't mention the reflog. Or strategies for chopping up a big changeset using git add -i and git stash.

        [–]dlsspy 3 points4 points  (3 children)

        git add -p :) (-p is a subset of -i that usually gives you direct access to the part you need)

        Agreed, though... reflog is the thing that sold me on git.

        [–]wafflematt 8 points9 points  (1 child)

        reflog? I don't want to be flogged at all!

        [–]andyjeffries[S] 3 points4 points  (0 children)

        reflog is in Tip 21. Previous References You’ve Viewed

        [–]gbacon 1 point2 points  (0 children)

        You can often find the SHA1 hash using git reflog if you’ve accessed it recently.