Liran
Liran

Reputation: 327

How do I force push a feature-branch to Gerrit?

I have been working on a (remote) feature branch and after changing the branch history, I want to push it to Gerrit (with force push).

I tried the following command:

git push origin HEAD:refs/for/branch_name --force

However, instead of changing the branch history, it just pushed the changes on top of the branch.

What am I doing wrong? How can i force-push or change the remote branch history? thanks.

Upvotes: 4

Views: 9672

Answers (2)

Execute this:

git push -f origin HEAD:refs/heads/branch_name

Upvotes: 4

crea1
crea1

Reputation: 12557

This should do the trick

git push origin branch_name -f

Upvotes: 1

Related Questions