I have a Git repository which is being managed with Gerrit, where you don't push to <branch>, but instead push to refs/for/<branch>, and then magic happens. Thus, I'd like different behavior for git pull and git push. In particular, I want git pull to pull from <branch>, but git push to push to refs/for/<branch>. Is it possible to set this up in Git?
(Note: this has been asked before, but the answer was simply, "no, but here's how you can make Git force you to always specify the refspec so you'll never accidentally push to the wrong branch," which isn't the answer I'm looking for)
I use the following configuration:
I.e. add remote named
review, set default push remote for all branches toreview, configure fetch/pull formasterfrom remote branchmaster, configure push formasterto remote branchrefs/for/master.