Skip to content

Git: Resetting commit tree

Anthony edited this page Oct 10, 2016 · 3 revisions

Problem

My pull request was just accepted and squashed in GitHub. I would like to force my local branch to accept that squash.

Commands

This is a coarser method for dealing with squashes upstream. It's slightly more efficient if you have no changes after the GitHub squash. If you have changes you would like to keep, check out "rebasing."

git fetch --all
git log upstream/master --

Use this log to inspect that your recently accepted pull request is in that tree. The "--" afterwards ensures that it's looking at the remote, not just the remote tracking branch (although the fetch should make sure that is also up to date).

Type "q" to exit the log.

git reset --hard upstream/master --
git push -f origin master

Clone this wiki locally