I've been working on a project and things got sloppy. I've reset
to a stable commit, but when I try to push
I'm told "the current branch is behind its remote counterpart" (obviously). The only option that Git gives me to perform is git pull
. When I try that I'm back to the newer, sloppy commits that don't work and I don't want.
I made a different branch called stable
and ran reset --hard
to the stable commit and then tried the following:
$ git checkout stable
# => Switched to branch 'stable'
$ git merge -s ours master
# => Already up-to-date.
$ git checkout master
# => Switched to branch 'master'
# => Your branch is behind 'origin/master' by 9 commits, and can be fast-forwarded (use "git pull" to update your local branch)
$ git merge stable
# => Already up-to-date.
After running these commands my master
branch is still in the state that I want to get rid of.
I'd like to have stable
be the new master
but am unsure what to do now.
You're looking for a force push (see the --force
option). Just have a care with that as you probably do not normally want to change the history of a remote branch shared with other developers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With