Kusina on GitHub
Last updated
Kusina is on GitHub now, and changes come from two places: Ana's laptop, and GitHub itself, where she and Joaquin edit in the browser. In this project you'll bring a browser edit down to the laptop, settle a clash between the laptop and GitHub, and push a branch that's ready for Stage 5's first pull request.
By the end of this lesson you can
- Bring a commit made on GitHub down to your computer
- Recover from a push rejected because of a browser edit, and settle the clash
- Push a new branch to GitHub
The brief
You're Ana, in kusina on your laptop. It's connected to Kusina on GitHub as origin. This morning, on your phone, you edited the README on GitHub to add Lola Remy's advice.
- Find out what GitHub has that your laptop doesn't, without changing anything: fetch, then status.
- Pull it down, and find the README commit in your history.
- Lola says the leche flan needs 45 minutes. Change the steaming line in
leche-flan.md, commit, and push. (Joaquin is editing on GitHub at the same time.) - If the push is rejected, pull, settle the clash on 45 minutes, commit and push.
- Start a branch
ube-halaya, addube-halaya.mdwith a title and a line or two, commit, and push the branch to GitHub with an upstream.
Build it
- Fetch, then see with
git statusthat you’re behind - Pull, and have the README commit in your history
- Commit the leche flan at 45 minutes
- GitHub’s leche flan says 45 minutes, with Joaquin’s commit in your history and no conflict markers left
- The
ube-halayabranch pushed to GitHub
Working folder
no changes
Staging area
nothing staged
Repository
10 commits on main
Remote
origin: example.com/ana/kusina.git · in step, as of your last fetch
You are in ~/kusina, connected to Kusina on GitHub as origin. This morning you edited README.md on GitHub, in your phone’s browser.
Commit graph
67e435dHEAD →mainorigin/main Cover the leche flan with foilba04ca2Add lumpiang shanghai recipe98a5edcAdd a script that builds the index paged078487Make the sinigang steps clearer145dc1eAdd pancit bihon recipe52d1f4dSay how much salt goes in the adobo1c17fadAdd a README9c53888Add leche flan recipe1f359a2Add sinigang recipe601c654Add adobo recipe
On GitHub, pushing a new branch makes a yellow banner appear on the repository page: "ube-halaya had recent pushes", with a Compare & pull request button. Lesson 5.2 presses it.
Spot the trap: editing in two places
Ana often fixes a typo on GitHub from her phone, then carries on working on her laptop without pulling. Every few days her push is rejected and she has to merge.
What happens if…
Check your history
Run git log --oneline --graph -6. You should see your 45-minute commit and Joaquin's 50-minute commit side by side, joined by a merge commit, with the README commit below them.
Sources
Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.
- GitHub Docs: Editing files: a browser edit is a commit on GitHub
- Git documentation: git-pull: bringing GitHub's commits into your branch
- Git documentation: git-push, Note about fast-forwards: why a push is rejected