Gitup: Using GitUp with Gerrit

Created on 15 Nov 2016  ·  8Comments  ·  Source: git-up/GitUp

At work we use Gerrit Code Review for our PRs. When submitting a PR to Gerrit we only use a single commit, using "git commit --amend" for any revisions. I'd really like to use GitUp but I am unsure of how to in this workflow.

Basically if I am working on a new feature or bug this is my workflow using CLI.

  • Create new branch
  • Write code, test, rewrite, etc.
  • When everything is done and working as expected (on new branch)

    • git commit -m <MESSAGE>

    • git fetch

    • git rebase origin/dev

    • git push origin HEAD:refs/for/dev

The push output gives me back a URL that links to the Gerrrit PR.

I have been doing everything in GitUp including the commit recently but because I am unsure of how to config GitUp I am afraid of messing up our repo with a bad push. Can someone help me to understand how GitUp should be configured for this type of workflow?

Thank you.

question

Most helpful comment

Hey, would it be possible to simply add custom commands support for doing that kind of thing? I have this working in SourceTree via Custom commands, see screenshot:
custom_actions

All 8 comments

When you say git push origin HEAD:refs/for/dev, what is this refs/for/dev reference? Is it a placeholder for something you change each time or is it always this reference?

It is always a reference. It has to do with the magic Gerrit does to intercept the PR from going straight to GH.

This answer on SO explains it better than I can -- http://stackoverflow.com/a/10461674

Yes, this is a reference indeed, but what I'm asking is: do you always push to this same reference refs/for/dev from any of your work branches?

Sorry, my misunderstanding. We always push our local branches with changes to "HEAD:refs/for/dev"

OK, so it's some sort of magic reference server-side. In this case, you cannot do the push from GitUp, since contrary to the CLI it doesn't let you enter an arbitrary reference to push to. You can however to the previous 3 steps in GitUp.

Don't underestimate the need for Gerrit support in the tool, my impression is that more reviews are passed via Gerrit worldwide than via GitHub PRs.

PS. I do personally prefer GitHub PRs, not trying to promote Gerrit here. Still is not up to developer preference to pick the review platform.

Hey, would it be possible to simply add custom commands support for doing that kind of thing? I have this working in SourceTree via Custom commands, see screenshot:
custom_actions

Hmmm, I also assumed this wouldn't be a big thing. Well, it shouldn't be too hard to add this functionality, so there might be a PR some day. ⏰🤗

Was this page helpful?
0 / 5 - 0 ratings