Search code examples
gitgerritfeature-branch

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.


Solution

  • This should do the trick

    git push origin branch_name -f