| DWIM | 唯一匹配的远端分支自动建本地跟踪 |
|---|---|
| 显式 | git switch -c feature/x origin/feature/x |
| 前提 | 先 fetch 更新远端引用 |
常用示例
常用示例
git fetch
git switch feature/login
git switch -c feature/login origin/feature/login
git branch -vv团队约定本地名与远端名一致时,DWIM 让检出一步到位。
把远端分支拿到本地:switch <名称> 在唯一匹配时自动建立跟踪(DWIM);显式写法为 switch -c <本地> origin/<远端>。
| DWIM | 唯一匹配的远端分支自动建本地跟踪 |
|---|---|
| 显式 | git switch -c feature/x origin/feature/x |
| 前提 | 先 fetch 更新远端引用 |
git fetch
git switch feature/login
git switch -c feature/login origin/feature/login
git branch -vv