Git: How to Sync Fork with Master

You have forked numbers of repositories, but have no idea how to merge with the master copy if there’s changes. So here the solution.

# Add Upstream Remote
git remote add upstream [URL]

# Fetch Upstream
git fetch upstream

# Checkout master (your fork repo & in case you're not in master branch yet)
git checkout master

# Merge
git merge upstream/master

# Push to Fork
git push origin master

Leave a Reply

Your email address will not be published. Required fields are marked *

two × two =