0

I'd like to squash some of my previously pushed commits in my git repository. I found a solution here, which correctly allowed me to squash many of the commits. However, after completing my interactive rebase, I get the following error:

remote: To prevent you from losing history, non-fast-forward updates were rejected.

Specifically, here are the commands I ran:

git rebase -i origin/mainline~6 mainline

pick <hash1> <Message 1>
squash <hash2> <Message 2>
squash <hash3> <Message 3>
squash <hash4> <Message 4>
squash <hash5> <Message 5>
squash <hash6> <Message 6>

then I changed the comment to the ones I wanted, and tried running both of these commands, both of which failed with the above message:

git push --force origin mainline

git push origin +mainline

Any idea of what went wrong? The rebase seems to have worked, but then it keeps asking me to pull/rebase the changes I want to overwrite...

lcta0717
  • 402
  • 5
  • 13

0 Answers0