gitpractice.dev

brewly — Ch.3 · Someone was faster

Exercise 6 of 9

Before you start

When both sides have commits

If you and a teammate both committed, the server refuses your push: it would lose their work.

You then pull. Git asks how to combine the two: merge them, or rebase (chapter 6). For now, choose merge.

The merge opens an editor with a suggested message. Press "Save and close".

git push
send your commits
git pull
update; stops if the histories differ
git pull --no-rebase
update by merging
git log --oneline --graph
see how the two lines joined

First, your own commit

Your change is already in the folder. Stage and commit it before pushing.

git add .
stage it
git commit -m "What you did"
commit it
You can reopen this any time with “Lesson”.

Continue on a desktop

Typing git on a small screen is no fun. Open this page on a laptop or desktop to practise.

Back to the path