Skip to content

Instantly share code, notes, and snippets.

@junagao
Forked from CristinaSolana/gist:1885435
Last active June 29, 2020 14:52
Show Gist options
  • Save junagao/4f2483a7e71c289fb53348d540a6a5b5 to your computer and use it in GitHub Desktop.
Save junagao/4f2483a7e71c289fb53348d540a6a5b5 to your computer and use it in GitHub Desktop.
Git: Keeping a fork up to date

Git: Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo

2. Add remote from original repository in your forked repository:

git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git

3. Fetch all branches of remote upstream:

git fetch upstream

4. Rewrite your master with upstream’s master using git rebase:

git rebase upstream/master

5. Push your updates to master. You may need to force the push with “--force”

git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment