department of hack
1545 stories
·
16 followers

Things I wish everyone knew about Git (Part I)

1 Share

This is a writeup of a talk I gave in December for my previous employer. It's long so I'm publishing it in several parts:

How to approach Git; general strategy

Git has an elegant and powerful underlying model based on a few simple concepts:

  1. Commits are immutable snapshots of the repository
  2. Branches are named sequences of commits
  3. Every object has a unique ID, derived from its content

black and white white ink
diagram of the elegant geometry of the floor plan of a cathedral

Built atop this elegant system is a flaming trash pile.

literal dumpster fire

The command set wasn't always well thought out, and then over the years it grew by accretion, with new stuff piled on top of old stuff that couldn't be changed because Backward Compatibility. The commands are non-orthogonal and when two commands perform the same task they often have inconsistent options or are described with different terminology. Even when the individual commands don't conflict with one another, they are often badly-designed and confusing. The documentation is often very poorly written.

What this means

With a lot of software, you can opt to use it at a surface level without understanding it at a deeper level:

“I don't need to know how it works.
I just want to know which commands to run.”

This is often an effective strategy, but

with Git, this does not work.

You can't “just know which commands to run” because the commands do not make sense!

To work effectively with Git, you must have a model of what the repository is like, so that you can formulate questions like “is the repo on this state or that state?” and “the repo is in this state, how do I get it into that state?”. At that point you look around for a command that answers your question, and there are probably several ways to do what you want.

But if you try to understand the commands without the model, you will suffer, because the commands do not make sense.

Just a few examples:

  • git-reset does up to three different things, depending on flags

  • git-checkout is worse

  • The opposite of git-push is not git-pull, it's git-fetch

  • etc.

If you try to understand the commands without a clear idea of the model, you'll be perpetually confused about what is happening and why, and you won't know what questions to ask to find out what is going on.

READ THIS

When I first used Git it drove me almost to tears of rage and frustration. But I did get it under control. I don't love Git, but I use it every day, by choice, and I use it effectively.

The magic key that rescued me was

John Wiegley's
Git From the Bottom Up

Git From the Bottom Up explains the model. I read it. After that I wept no more. I understood what was going on. I knew how to try things out and how to interpret what I saw. Even when I got a surprise, I had a model to fit it into.

You should read it too.

That's the best advice I have. Read Wiegley's explanation. Set aside time to go over it carefully and try out his examples. It fixed me.

If I were going to tell every programmer just one thing about Git, that would be it.

The rest of this series is all downhill from here.

But if I were going to tell everyone just one more thing, it would be:

It is very hard to permanently lose work.
If something seems to have gone wrong, don't panic.
Remain calm and ask an expert.

Many more details about that will be in next week's followup article.

Read the whole story
brennen
1 day ago
reply
Boulder, CO
Share this story
Delete

Ralph McQuarrie

1 Share






Ralph McQuarrie

Read the whole story
brennen
1 day ago
reply
Boulder, CO
Share this story
Delete

Running it up the flagpole

1 Share

Two months ago, I was browsing Reddit when I stumbled across a post that said: “TIL that the current American Flag design originated as a school project from Robert G Heft, who received a B- for lack of originality, yet was promised an A if he successfully got it selected as the national flag. The design was later chosen by President Eisenhower for the national flag of the US.” After I read the submission, which received more than 21,000 upvotes, I was skeptical enough of the story to dig deeper. The result is my article “False Flag,” which appeared today in Slate. I won’t spoil it here, but rest assured that it’s a wild ride, complete with excursions into newspaper archives, government documents, and the world of vexillology, or flag studies. It’s probably my most surprising discovery in a lifetime of looking into unlikely subjects, and I have a hunch that there might be even more to come. I hope you’ll check it out.



Read the whole story
brennen
2 days ago
reply
Boulder, CO
Share this story
Delete

Tropes? In This Economy?

1 Share

Somewhere on the list of problems with the Internet, no worse than ten-billionth place I should say, is that nobody has created a TV Tropes page for my DariaSandman crossover epic.

Read the whole story
brennen
2 days ago
reply
Boulder, CO
Share this story
Delete

People We Should Remember

2 Shares
Clela Rorex, shown here in her office while she was serving as Boulder County clerk in 1975, says she didn’t anticipate the hate-filled response after she issued marriage licenses to same-sex couples.

There’s been a few deaths lately of people who might not be famous but who really worked to make the lives of people better. They deserve a moment of remembrance. Let’s start with Clela Rorex, a woman who made a truly remarkable stand at a time when such things seemed impossible:

Clela Rorex, who made headlines in 1975 when, as the Boulder County clerk in Colorado, she issued a marriage license to a gay couple, one of the first to do so in the nation, died on Sunday at a hospice center in Longmont, Colo. She was 78.

….

Mr. Poston said that when, just days later, on March 26, David McCord and David Zamora came to her seeking a marriage license, granting it was more an affirmation of her personal beliefs than an attempt to make national news.

“She didn’t do it to make a statement or create an uproar,” he said in a phone interview. “She just did it because she realized she would have an ideological contradiction if she didn’t believe in discrimination but discriminated against these men.”

She had some legal support — she had received an opinion from William C. Wise, the county’s assistant district attorney, who said that a same-sex marriage did not appear to be specifically prohibited by state law. In early April she granted a marriage license to two women, again making news.

She granted several other licenses to gay couples — “Colorado has become a mini‐Nevada for homosexual couples,” The New York Times said at the time — before the state attorney general, J.D. MacFarlane, contradicted Mr. Wise with an opinion that marriages had to be between a man and a woman.

That led Ms. Rorex to stop issuing same-sex licenses, but her actions had already made her a hero in the gay-rights movement, as well as a target.

“I was just so inundated with mostly hate mail during that time period,” she told The Associated Press in 2004. “It was really incredible the letters I got.”

My friends, you too, no matter what your job, can make a real difference in the world, even if you don’t seem like a pioneer now when you do the right thing. Who exemplifies this principle more than Rorex?

I might also point here to Haleh Afshar, the Muslim feminist who fought for the civil rights of other Muslim women, Jeffery Escoffier, the gay theorist and health activist, or the cancer activist Deborah James. None of these people are really that special per se. They are just people who did the right thing. We can all be activists. And note how unimportant electoral politics are to making change among these people. It’s far from the only way to make change; it may not be the most important. Only Rorex won elected office here and that the kind of lower level office that a lot of people can win.

Of course there are also dead assholes who do not deserve a good memory.

Read the whole story
brennen
2 days ago
reply
Boulder, CO
hannahdraper
3 days ago
reply
Washington, DC
Share this story
Delete

Software Freedom Conservancy: Give Up GitHub: The Time Has Come!

1 Comment and 3 Shares
The Software Freedom Conservancy (SFC) has issued a strong call for free software projects to give up GitHub and to move their repositories elsewhere. There are a number of problems that SFC has identified with the GitHub code-hosting service and, in particular, with its Copilot AI-based code-writing tool that was trained on the community's code stored in the company's repositories. Moving away from GitHub will not be easy, SFC said, but it is important to do so lest the free-software community repeat the SourceForge mistake.
Specifically, we at Software Freedom Conservancy have been actively communicating with Microsoft and their GitHub subsidiary about our concerns with "Copilot" since they first launched it almost exactly a year ago. Our initial video chat call (in July 2021) with Microsoft and GitHub representatives resulted in several questions which they said they could not answer at that time, but would "answer soon". [...] Last week, after we reminded GitHub of (a) the pending questions that we'd waited a year for them to answer and (b) of their refusal to join public discussion on the topic, they responded a week later, saying they would not join any public nor private discussion on this matter because "a broader conversation [about the ethics of AI-assisted software] seemed unlikely to alter your [SFC's] stance, which is why we [GitHub] have not responded to your [SFC's] detailed questions". In other words, GitHub's final position on Copilot is: if you disagree with GitHub about policy matters related to Copilot, then you don't deserve a reply from Microsoft or GitHub. They only will bother to reply if they think they can immediately change your policy position to theirs. But, Microsoft and GitHub will leave you hanging for a year before they'll tell you that!
Read the whole story
jepler
3 days ago
reply
While back in the day I would have wanted to host my own thing, these days .. I don't. so if I were to move personal projects away from github, I'd want a hosted service. And I'd hate to give up continuous integration (though I'm willing to rewrite away from github's proprietary yml format for CI)

Codeberg is a nonprofit based in the EU, but it looks like their CI offering isn't ready yet. sourcehut does have a CI, but I don't know anything about it.
Earth, Sol system, Western spiral arm
brennen
2 days ago
A few notes here on sourcehut: https://phabricator.wikimedia.org/T217852 - I imagine they've added / refined a bunch of stuff since then.
brennen
2 days ago
reply
Boulder, CO
Share this story
Delete
Next Page of Stories