Git Rebase From Upstream

Sunday, November 8, 2020 · 1 minute · 96 words

How to apply new commits in your forked repo from the parent (upstream) repo ?

If not already done, add a “remote” to the parent’s repo like this :

git remote add parent https://github.com/project/name.git

Then, fetch all commits from the parent’s branch master (or any branch you like) :

git fetch parent master

Now, apply all new commits to your repo :

git rebase parent/master

You may have conflicts to solve if you’ve done modifications on your repo. Solve them before going on.

Finally, push (and force) all your modifications :

git push --force origin master
git howto