How can I push a local Git branch to a remote with a different name easily?

前端 未结 5 1478
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 16:38

I\'ve been wondering if there\'s an easy way to push and pull a local branch with a remote branch with a different name without always specifying both names.

For exa

5条回答
  •  孤独总比滥情好
    2020-11-30 17:31

    When you do the initial push add the -u parameter:

    git push -u origin my_branch:remote_branch
    

    Subsequent pushes will go where you want.

    EDIT:

    As per the comment, that only sets up pull.

    git branch --set-upstream
    

    should do it.

提交回复
热议问题