Right now, my fork of dev.to displays this message:
How do I update my fork so that it's the same as thepracticaldev:master?
cd
into the directory of the cloned repo
Running git remote -v
will display the current remotes
Add the parent repository as a new remote, specifying it as the upstream repository. In this example, we will run
git remote add upstream https://github.com/thepracticaldev/dev.to.git
Verify with git remote -v
Fetch the upstream repository with git fetch upstream
The commits that are different from my fork are now in separate branches in my local environment. Let's merge those. git merge upstream/master
Now my cloned repo looks just like the upstream repository.
NOTE: any changes made locally before the merge are preserved, so you don't have to worry about losing any of your work when you do this.
From now on, whenever I need to sync with the upstream repository, all I need to do is fetch and merge.
At this point, running git push
will update the forked repo and display this message: