gitpractice.dev

brewly — Ch.6 · Pull without a merge bubble

Exercise 3 of 8

Before you start

Rebase instead of merge when pulling

When you and a teammate both committed, git pull --rebase fetches their commits and replays yours on top. No "Merge branch" commit appears.

This is safe: only your unpushed commits are rewritten.

git config pull.rebase true makes it the default for this repository.

git pull --rebase
fetch, then replay your commits on top
git log --oneline --graph
check the history is a straight line
git push
share your commit
git config pull.rebase true
always pull this way here
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