git alias for HEAD:refs/for/master

前端 未结 8 2243
予麋鹿
予麋鹿 2020-12-02 09:18

I am configuring Gerrit and I would like to avoid writing:

git push gerrit HEAD:refs/for/master

I would like to write:

8条回答
  •  借酒劲吻你
    2020-12-02 09:30

    Those of you who want to push only to master branch through gerrit, add the following to .git\config

    [remote "review"]                                                        
        push = HEAD:refs/for/master                 
        pushurl = ssh://GERRIT_URL:29418/PROJECT_NAME
    

    or execute in project dir

    git config remote.review.push HEAD:refs/for/master
    git config remote.review.pushurl ssh://GERRIT_URL:29418/PROJECT_NAME
    

    Then you can use

    git push review
    

    to push to Gerrit. Using this method you can push from any of your local branches and the data will always go to master branch

提交回复
热议问题