Configure a local branch for push to specific branch

前端 未结 2 570
别跟我提以往
别跟我提以往 2020-12-13 21:21

Sorry if this question has been asked already.

Am cloning from a repo named \"git_lab\" which has a branch named \"test\" When cloning i use \"-b myname_test\" to cr

相关标签:
2条回答
  • 2020-12-13 21:46

    There are two things you can do here.

    • Set push.default to tracking, so that it will push all branches to the remote branches they track, not the ones they have the same name as, then configure your branch with appropriate tracking information. (e.g. set branch.master.remote to origin and branch.master.merge to refs/heads/foo.)

    • Push manually. git push origin master:foo will push your local master branch to the branch foo on the remote origin.

    However, I'd suggest that what you really want to do is just make the branch names the same.

    (You can set config parameters either with git config, e.g. git config push.default tracking, or by directly editing the .git/config file.)

    0 讨论(0)
  • 2020-12-13 21:55
    git checkout --track origin/branchname
    

    Alternatively, you can edit the config file in the .git folder.

    0 讨论(0)
提交回复
热议问题