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

9k views Asked by At

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.

2

There are 2 answers

1
crea1 On BEST ANSWER

This should do the trick

git push origin branch_name -f
0
Marcelo Ávila de Oliveira On

Execute this:

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