brewly — Ch.6 · Push a rebased branch
Exercise 6 of 8
Before you start
After rebasing a pushed branch
The server still has your old commits, so a plain push is rejected. You have to replace them.
git push --force-with-lease replaces the branch only if the server still has what you last saw. If a colleague pushed in the meantime, it refuses.
Plain --force overwrites without looking. Avoid it, and never force push a shared branch such as main.
- git rebase main
- replay your branch on the new main
- git push
- try it, and read the rejection
- git push --force-with-lease
- replace your branch on the server
You can reopen this any time with “Lesson”.
# BrewlyOrder coffee ahead.## Team- Maya (lead)- Alex (frontend)
Graph
- 3039a99 Sharpen the sloganorigin/mainmain
- 6d74220 Add opening hoursHEAD → feature/hoursorigin/feature/hours
- 1354d06 Add menu page
- 619eb3b Style the order button
- 5fc44ac Initial commit