I saw it with my own eyes
Committed a change, and a colleague cannot find it on the site? This lesson explains how your work reaches the copy everyone sees.
The scene
At 8:00 on Sunday a woman parked outside the court and paid the meter for one hour: enough, she thought, to hand in the application papers in her envelope and get back to work. At 8:05, ticket in her pocket, she reached the public window, where people hand in papers. It was shut.
Ibrahim, the head clerk, chief of the staff who keep case papers, passed by. "Stocktake today. We count the archive, the room of old files, file by file. The window opens at twelve. Najla wrote a notice on Thursday evening; it's on our page."
Her phone showed the court's page: no notice. "I can't come back another day." She sat down to wait, going out to feed the meter as each hour ran out.
Ibrahim went up to Najla, who was sure. "I wrote it at home and committed it. I saw it with my own eyes."
"And I see the old page."
At 8:40 she took her laptop to Hussam in the IT office. At the top of its list of sat "Notice: window closed Sunday morning for stocktake until 12:00", Najla, Thursday, 9:40 pm. Saving writes the change into a file; a commit records the files' state in the history. She had done both.
"It's here," said Hussam, "on the copy from last week to work offline at home. A full copy of a , with every commit, is a ."
On , in the browser, he showed her the : "The copy we all agree on. The page is built from it." Its last commit was Faris's, made in the browser on Thursday afternoon to fix a line on another page. No notice.
"Your commit stays on your laptop until you send it. Sending it to GitHub is a ; you never did."
Najla pushed. A red message: rejected.
"Faris's commit is here, and your copy doesn't know it. GitHub won't let you write over work you haven't seen. Bring it down first."
She did: a . Faris's commit landed beside hers. It was in another file, so the two combined without a . She pushed again, and at 8:55 the notice showed. Hussam published the page by hand.
Najla left the laptop and went down to the stocktake. Back for it at 11:00, she found Leila, a lawyer often at the court, asking for the attendance-sheet template, the sheet a witness gives his employer as proof. "My clients, the people I represent, need one for their employers when they visit my office, with its name on top."
"Anyone can read our repository, and only we write to it," said Hussam. "But you can take a copy."
Leila made a of the court's repository on her GitHub account. "Your copy, under your name," said Hussam. "Change what you like and nothing changes here. If you find an improvement for us, open a ."
She put her office's name on the template and saved. In the court's repository, the template was unchanged.
From the window Najla saw the woman at the meter, going through her purse. She went down, paid the last hour for her, and handed her the ticket for her car.
The idea
A repository lives on GitHub and on the computer of each person working on it.
| Where | GitHub: the team's reference, source of the pages | your computer, every commit included |
| Edits | browser edits land here | possible offline, unseen until you push |
- : sends your commits to the remote.
- : brings down what others added there. If a push is rejected, pull first, then push.
- : your GitHub copy of a repository you cannot write to. The original stays unchanged; offer its owners useful changes in a .
If a colleague works from yesterday's copy, ask whether they have pulled since.
Try it yourself
- In a of yours, press Code. You will see its address and ways to it. Do not take a copy yet.
- Edit a file in the browser and save it as a . It joins the commit list, since the browser works on the .
- Make a of a repository you cannot write to. Under its name, a line names the original.
- Change a file in your fork, then open the original. It is unchanged.
Taking the copy itself needs a program on your computer.
Where this fits
The work has left the court for homes and Leila's office. Next: the files saying what a repository is and what its owners allow.