How to get rid of false dependencies in gerrit

后端 未结 3 1669
小蘑菇
小蘑菇 2021-02-08 08:32

It appears that when using gerrit, by default all changes depend on the previous one. I do not branch for new changes, I simply work off the master branch and then push the comm

相关标签:
3条回答
  • 2021-02-08 08:53

    This is what Gerrit means by dependencies - A commit which is on top of another commit. If both are in review, the newer one depends on the older one.

    If you don't want them to depend on each other, don't create the commits on top of each other. Create one commit, then make a new branch based on master for your next commit

    (git checkout origin/master -b NEW_BRANCH_NAME).

    When you push the second commit up for review, it's parent will already be published and it won't depend on anything.

    0 讨论(0)
  • 2021-02-08 09:05

    I've been taught to get around this by doing git reset --hard HEAD~1 after each git push.

    0 讨论(0)
  • 2021-02-08 09:09

    As a variant to git reset --hard HEAD~1 I use this instead:

    git reset --hard origin/master
    

    Assuming, I'm working in master for a quick change.

    Otherwise, working in a topic branch is much preferred.

    There are many Git scripts to help manage topic branches:

    • git-flow
    • git extras
    • git create-branch

    I'm sure there are others.

    0 讨论(0)
提交回复
热议问题