Getting existing git branches to track remote branches

前端 未结 7 951
一整个雨季
一整个雨季 2021-01-29 21:43

My usual workflow when working with git, is something like this:

  1. create a local repository
  2. do some work in that repository, add/change files etc.
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-29 21:51

    git help remote should show you what you need to know. I think what you want is

    git remote add [remote-name] [remote-url]
    
    # Set a local branch to follow the remote
    git config branch.[branch-name].remote [remote-name]
    
    # Set it to automatically merge with a specific remote branch when you pull
    git config branch.[branch-name].merge [remote-master]
    

    You can also manually edit .git/config to set these up.

提交回复
热议问题