Skip to content

Instantly share code, notes, and snippets.

@vladak
Created February 20, 2017 15:21
Show Gist options
  • Save vladak/585c0500cd7851543f73b4b40c623a46 to your computer and use it in GitHub Desktop.
Save vladak/585c0500cd7851543f73b4b40c623a46 to your computer and use it in GitHub Desktop.
sync with upstream

from @DaveRandom:

  • Add another remote to your local clone: git remote add upstream https://github.com/OpenGrok/OpenGrok (this will also work with git@github.com:OpenGrok/OpenGrok.git if you prefer to work over SSH)
  • Fetch information about the new remote you just added to allow you to work with it locally: git fetch upstream
  • Sync your local changes with the upstream remote: git pull --rebase upstream master. After doing this you may need to resolve conflicts, git will instruct you on what it expects you to do. By the looks of if you shouldn't currently have any issues with this.
  • "Squash" your commits into a single commit: git rebase -i HEAD~14. This will start an interactive rebase, it will launch a text editor to enable you to complete it, more info here.
  • Once you have done this you will need to perform a forced push (git push -f) to the master branch of your origin remote to update this pull request.

I HIGHLY RECOMMEND that you practice this by creating a new local branch based on your current master (git checkout -b practice-branch) since this can potentially irrevocably destroy your history if you get it wrong. DO NOT perform any git push -f commands, or use the -f flag for any git command, until you are 100% certain that it is required and that it will do the right thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment