My company uses Gerrit Code Review for Git. I’ve been given a custom incantation to use every time I want to push code changes:
git push origin HEAD:refs/for/my-branch-name
Other than “my-branch-name”, that’s it verbatim. The refs/for/ syntax seems crazy to me, and is not something I’d seen before in Git.
How can I configure my repo so that git push alone does the same as the above?
You can update the push ref-spec for your remote by typing
I’ve created a git post-checkout hook that makes sure all branches (and master) are configured for use with gerrit. I think it works but your work flow might differ from mine so read the script and understand it (it’s not hard) before using it.