Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of false dependencies in gerrit

Tags:

git

gerrit

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 commited changes to a remote origin/master. A dependency is created every time even if the two commits have nothing to do with each other.

I've run into a few issues which makes me think that I am not using git correctly in combination with gerrit.

What should happen differently in my git/gerrit workflow for every commit to not be dependent on the previous commit? I've also tried creating a new branch for the change:

> git pull origin master
> git checkout -b new_branch
> #make a change
> git add -A
> git commit #with gerrit's commit hook in .git/hooks
> git push origin <sha1>:refs/for/master

This works, but gerrit still reports a dependency on the previously commited item.

like image 961
Shellum Avatar asked May 01 '12 18:05

Shellum


People also ask

What does rebase mean in Gerrit?

Rebase a Change. Move a Change. Abandon/Restore a Change. Cherry-Pick changes of a Change.

How do I amend changes in Gerrit?

From the Gerrit Code Review dashboard, select Browse > Repositories. Under Repository Commands, click Create Change. In the Create Change window, enter the following information: Select branch for new change: Specify the destination branch of the change.

What is follow up change in Gerrit?

The Follow-Up changes are changes that are based on existing changes. This gives you an opportunity to create a chain of related changes. The "follow-up" feature allows you to create change-sets very quickly.


1 Answers

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.

like image 187
Brad Avatar answered Sep 28 '22 05:09

Brad