Colin Sygiel
Colin Sygiel

Reputation: 945

How do you sync your branch with origin/branch after rebase?

Every time I checkout "develop" branch, git pull, checkout my local branch, and git rebase develop, it applies a growing list of changes that have already been applied before, such that the terminal output reads something like :

Your branch and 'origin/branch' have diverged, and have 26 and 24 different commits each, respectively. (use "git pull" to merge the remote branch into yours)

I don't want to git pull because it will pull old changes and cause merge conflicts and every time I git push -f, it seems my local branch is back up to date with origin/branch, until this all happens again.

As you can probably already tell, I am not super familar with git, but I have the feeling that my local branch needs to be set as the current HEAD, maybe?

What can I do to sync my local branch and origin/branch such that future git rebase's doesn't continue applying old changes?

Upvotes: 2

Views: 2005

Answers (1)

VonC
VonC

Reputation: 1327164

how do I correct this and properly rebase in the future?

If you keep rebasing commit that were already pushed, you will end up with the same issue.
For a feature or fix branch though, where you are the only one, this is not a big deal, and a push -f is enough.

Upvotes: 2

Related Questions