1. 30
  1.  

  2. 5

    This is an oldie but a goodie, for the simple fact that git is not only so common, but that knowledge of its ins and outs is valorized among programmers. I should be perfectly happy if someone read this entire page and the only lesson they took away was, ‘wow, git is a very poorly designed program.’

    1. 6

      I am in the midst of teaching my web development students how to use git and - as is true every year - I am appalled at how convoluted it is. Git is the software equivalent of English.

    2. 2

      I think it’s showing it’s age now. There are finally different commands for dealing with branches vs updating file contents.

      git switch $branch will change your branch. git switch —create $branch will create a new one. git restore —source=$commit $file will update a file’s contents to the given commit.

      Of course, git checkout is still there.

      1. 2

        I realize there’s a lot to criticize about git here, but I read it in good faith and got the following out of it:

        Silence

        From git --help config:

        To avoid confusion and troubles with script usage, aliases that hide existing Git
        commands are ignored
        

        I don’t understand why Master Git said “there was no problem” though.

        One Thing Well

        From git --help checkout:

        Updates files in the working tree to match the version in the index or the specified tree. If
        no pathspec was given, git checkout will also update HEAD to set the specified branch as the
        current branch.
        

        I think of it as “make the working tree correspond with a branch”, remembering that branches are just pointers to commits and thinking of HEAD as a special branch that points to the current branch.

        Only the Gods

        I always think of git history as something that should be massaged to tell the story you want, not as a complete accounting of the facts. Branches are designed to be ephemeral and help you, not the narrative.

        The Hobgoblin

        So frustrating.

        The Long and Short of It

        The -h / --help distinction isn’t very UNIXy, but it is convenient. git -h branch not working seems like a frustrating omission though.

        Stories with similar links:

        1. Git Koans via friendlysock 3 years ago | 20 points | 2 comments
        2. Git Koans via pushcx 5 years ago | 10 points | no comments