Last active
June 14, 2016 03:44
-
-
Save olzaragoza/299b25d2e7b9ef32370013a118b4b50f to your computer and use it in GitHub Desktop.
git commands to cleanly sync a fork with the original repo without dirtying up the commit history with pull requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add upstream /url/to/original/repo | |
git fetch upstream | |
git checkout master # only needed if not already in master | |
git rebase upstream/master | |
git push | |
also, | |
git push --tags # to sync tags/releases | |
*To forcibly sync your fork* | |
doing this may affect commit history and create conflicts of forks of your repo | |
git remote add upstream /url/to/original/repo | |
git fetch upstream | |
git checkout master #only needed if not already in master | |
git reset --hard upstream/master | |
git push origin master --force | |
replace "master" with each branch name that needs to be synced and repeat as needed | |
the result will be a forked branch even with the original branch | |
*warning* | |
any changes made ahead of the original branch will be lost | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment