LivingRobot
LivingRobot

Reputation: 913

Git Rebasing issue

I'm basically brand new to Git and am having some trouble rebasing. I had 9 commits on my branch - and I wanted to squash some of them together. So, in IntelliJ I did

git rebase -I

and went into the file and successfully altered my commits so that there are now only 7 commits. However, I then went to push to GitHub, and now, instead of altering the previous commits, it added the 7 commits as new and so there are 16 commits sitting on my branch.

How do I get my rebase to alter and not re-add?

Upvotes: 0

Views: 43

Answers (1)

Gary Ewan Park
Gary Ewan Park

Reputation: 18981

Following a rebase, which by the way you would typically never want to do on your repository's main branches (i.e. develop or master) you would need to do a force push, i.e. git push -f. This is due to the fact that the history of the repository has been changed, and as a result, you have to "overwrite" the history that is stored in the GitHub version of the repository. When you pushed your changes, did you do a force push?

Upvotes: 1

Related Questions