This gist is intended for users who follow a forked repository/pull-request git workflow. Overtime, you may notice your forked repository's master branch becomes cluttered with "merged upstream/master into master"-type commits. These commits don't serve much of a purpose, and tend to clutter the commit history of any new pull requests you make.
By running the scripts below, we will delete your old master and create a new one based off of upstream/master. This will remove all of those unnecessary commits we don't want to see anymore. Based on the nature of how this works, you should be aware of a few things:
- This method relies on a force push, and "erases" git history. This is a bad practice, especially when working on the same repository with other people, so make sure you understand the consequences of a force push before you do it.
- Any work you have in your fork's
masterbranch must have been merged toupstream/masteror saved in another branch. If not, you will lose it all. - I