有时review其他成员的Pull request,或基于另外一个remote branch进行change,我们要checkout remote branch,创建本地branch。
- 当前一般是本地master branch,先fetch一把,将最新remote branches拉到本地,
不然识别不了remote branches
, Run command: git fetch - 查看所有Fetch到的remote branches, Run command: git branch -r
- 基于remote branch,创建local branch并切换到新的branch,一般loca branch名字和remote branch名一样,方便识别。
Run command: gitcheckout
-b local_branch_name remote_branch_name
例如:
git checkout -b feature/apac_story_12345 origin/feature/apac_story_12345
- 查看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