git-review patchsets pulling/rebasing latest before pushing

157 Views Asked by At

I'm trying to figure out a process by which multiple users are pulling a patchset review, making updates, and pushing but needing to rebase to the latest patchset.

  • So user 1 submits a change and now has a WIP gerrit review. -> patchset 1
  • So user 2 pulls his review say "git review -d 320" -> patchset 1
  • So now user 1 makes a new change, amends, and pushes, now the latest is patchset 2 (git commit -a --amend, git review -Rf)
  • Now user 2 makes a change, amends... but now he's behind on patchset 1, before pushing would like to check for any new patchsets and merge them down before pushing his changes up and creating patchset 3.

    Is this possible?

    I've tried "git review -N 320" and that seems to work fairly well but I would like to detect a newer patchset without actually downloading and merging it.

    Ideally i would like to put in a hook so it prompts the user to grab the latest patchset and merge changes before committing up.

    Maybe just a way to determine the local patchset version that was pulled so I can compare with the ls-remote patchset versions remotely?

    So this command will basically get me the latest patchset number up in git/gerrit... but i still don't know how to figure out which patchset i'm currently working on if i forgot which one i downloaded. --> think i have an acceptable solution for this.

    git ls-remote | grep /321/[0-9] | awk '{print $2}' | sort -V | tail -n 1 | sed 's/.*///g

  • 0

    There are 0 best solutions below