DEV Community

Discussion on: Git : Sync forked repo with original repo

Collapse
 
michaelcurrin profile image
Michael Currin

You can also do this to get your fork to match the upstream especially if you accidentally committed and want to get a clean fork

git checkout master 
git fetch --all # master and upstream
git reset --hard upstream/master

Make sure you stash work in progress. The hard flag will restore clean files and the reference to upstream will move your repo to be ahead or behind so it is in sync.

I also use the merge approach you suggested.