git pull --rebase origin main

Category: Git - Core

git pull --rebase origin main

Pull and rebase local commits on top

Fetches origin/main and replays your local commits on top of it instead of merging, giving a linear history. It is the explicit form of a rebase pull for a specific remote and branch. Set pull.rebase true to make it the default.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.