The attendance slip that nearly went wrong

You want someone to read your change before the public sees it, and a record of who approved it? This lesson shows the page on GitHub for that.

  • Lesson 4 of 10
  • 6 min

The scene

At 8:30 on Tuesday a nurse came to the court straight from her night shift at the hospital, badge still round her neck, to tell the judge as a witness what she had seen. At nine she entered Hall 2, where the judge hears witnesses, and by ten she was done.

At the public counter she asked for an attendance slip, a note the court gives witnesses to show their employer.

Such slips used to be handwritten. On Sunday Leila, a lawyer at the court most days, had said: "Witnesses ask me for one and don't know where to get it." So Ibrahim, the head clerk, asked Faris, the new employee, for a printable template.

"It will be ready today," said Najla, who writes the court's pages and templates. "Please wait." The nurse sat on the wooden bench by the counter.

At 10:30 Faris finished the template on his and opened a : a page on GitHub saying "here is my branch, and what it changes in main if merged". Under the title, the against main was all green, the template being new: the witness's name, the date, "Attended from 8:00 to 2:00", and at the foot, "Judge Sumaya".

Half an hour later Najla sat down at the page. "It's small, and she's waited an hour." She reached for the merge button.

Ibrahim, passing behind her, read the hours line. "Eight to two? She came at half past eight, and won't stay till two."

"Those are the court's hours," Faris said. "I thought they'd suit every witness."

One click, and the slip would print: the nurse would take to her hospital a court paper saying she stayed until two, though she left long before.

"Don't merge yet," Ibrahim said. "I want to read all of it."

Najla called Hussam from the IT office. He added Ibrahim to the request, and Ibrahim got an invitation to it: to read the diff line by line, commenting on the line he meant.

He read slowly. On the hours line he wrote: "Times differ by witness. Leave two boxes, for arrival and departure." At the last line he stopped. "Has anyone asked Judge Sumaya if she wants her name here?"

"No," said Faris.

On that line Ibrahim wrote: "No name until we ask her. The clerks' office signs." He sent the review as "Request changes"; the request now showed Ibrahim asking for changes, with his two comments.

Faris fixed both lines in a new on the same branch, which appeared on the request under the comments. Ibrahim read the diff again and at 12:10 gave his , recorded on the page with his name and the time. Najla the request.

At 12:20 Leila came in and took the first slip from the printer. "Who decided what goes on this?"

Ibrahim turned the screen to her: Faris's name, Ibrahim's two comments, his approval at 12:10. "The page stays after the merge," Hussam said.

At 12:30 Najla wrote "8:30" and "12:30" in the boxes, and Ibrahim signed. The nurse folded the slip twice and slid it into her badge holder, behind her photo. "Now I sleep," she said, "then back to my shift."

The idea

A pull request is where someone other than the author reads the work before it enters the main branch.

  • : a page showing a branch and what it will change in the if .
  • : reading the line by line and commenting on the line you mean; a fix is a new on the same branch.
  • : a written yes on the request, with its giver's name and the time.

If asked about a line a month later, open the pull request that brought it in: the page outlives the merge, naming who proposed and who approved.

Try it yourself

  1. Open a from last lesson's to main, with the reason in its description.
  2. In the request's , comment on the line you changed: the comment appears under it.
  3. Find where to submit a : you cannot approve your own request.
  4. Merge it, then open main: the line has changed, and the request page remains with your comment.

A real approval needs a colleague with access to your repository; some team repositories block merging without one.

Where this fits

Your change now passes a second reader before the merge. Next, a work-list item is linked to the pull request that completes it.

Check yourself

A colleague's changes a line in a form your office gives the public. "It's small," he says, "merge it without review." What do you lose?

Use the arrow keys to read the options, then press Space to answer.

Sources

Type a lesson, an idea or a job. English words work in Arabic too.