Can I map local branches to remote branches with different prefixes in git?

前端 未结 4 861
我寻月下人不归
我寻月下人不归 2021-02-13 19:01

We\'re working with a semi-centralized git repository here where I work. Each developer has their own subtree in the central git repository, so it looks something like this:

4条回答
  •  遇见更好的自我
    2021-02-13 19:20

    If you can, I suggest you use the same branch names locally & remotely. Then git push will push all of your local branches to corresponding branches in the central repository.

    To use different prefixes in local and remote repos, you need to add a mapping to your config file each time you create a new feature branch. The command to set up the mapping for topic/BRANCH_NAME is

     git config remote.origin.push refs/heads/topic/BRANCH_NAME:michael/BRANCH_NAME
    

提交回复
热议问题