有时review其他成员的Pull request,或基于另外一个remote branch进行change,我们要checkout remote branch,创建本地branch。

  1. 当前一般是本地master branch,先fetch一把,将最新remote branches拉到本地,不然识别不了remote branches, Run command: git fetch
  2. 查看所有Fetch到的remote branches, Run command: git branch -r
  3. 基于remote branch,创建local branch并切换到新的branch,一般loca branch名字和remote branch名一样,方便识别。
    Run command: git checkout -b local_branch_name remote_branch_name
    例如:
 git checkout -b feature/apac_story_12345  origin/feature/apac_story_12345
  1. 查看local branch与remote branch的关联, run command: git branch -vv
C:\xxx\Automation>git branch -vv
  master          8023a51e [origin/master] merge from release_major
* feature/apac_story_12345 cbb37931 [origin/feature/apac_story_12345] Merged PR 222001: fixed xxx autoamtion issue
Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐