DEV Community

Cover image for Git Cheat Sheet (Fork Repo)
Michelle Tan
Michelle Tan

Posted on • Updated on

Git Cheat Sheet (Fork Repo)

Here's a little cheat sheet for fork repo.

Track original repository

It's best to set this after you clone your fork.

# Set fork to track original repo
git remote add upstream https://github.com/[Original Owner]/[Original Repository].git
Enter fullscreen mode Exit fullscreen mode

Update your fork

# Sync your fork with original repo
git fetch upstream
git checkout master
git merge upstream/master
git push origin master
Enter fullscreen mode Exit fullscreen mode

Check your remote fork setup

git remote -v
Enter fullscreen mode Exit fullscreen mode

Top comments (0)