Search code examples
gitgithubgerrit

How to push feature branch in gerrit


While working with Gerrit, I created a new feature branch from master locally and then pushed it to the remote repository. That part works fine and the new branch can be seen on the remote.

But when I commit to that feature branch and try to push it, all my changes go to master branch. I don't understand why?

I double checked my location by running git branch (it is pointing to my feature branch)

Please explain what's going on here.


Solution

  • git branch is not enough: try and check the output of git branch -avv to see local and remote tracking branches.

    Combine that with git status, to check which branch you are currently using.

    Then you can make sure:

    • you actually are using feature branch
    • feature branch is indeed linked to an upstream branch.

    But in the case of Gerrit, make sure to push using the right URL: see Gerrit push.