【 Git四 】拉取远程分支
<h4>拉取远程分支到本地</h4>
<pre><code>git checkout -b ac_branch origin/ac_branch 拉取远程分支到本地(方式一)
git fetch origin ac_branch:ac_branch 拉取远程分支到本地(方式二)
git checkout e29440 拉取特定版本
git checkout -b <new-branch-name> 给分支命名</code></pre>
<p>方式一有可能出现错误提示:</p>
<p>fatal: 'origin/ac_branch' is not a commit and a branch 'ac_branch' cannot be created from it</p>
<p>解决方式:</p>
<p>执行命令:git fetch 同步一下仓库</p>
<h4>拉取远程分支到本地(方式一)</h4>
<pre><code>git checkout -b ac_branch origin/ac_branch</code></pre>
<p>方式一做了三件事:</p>
<p>1、拉取远程分支到本地
2、在本地创建一个分支与远程分支对应
3、自动切换到刚创建好的分支</p>
<h4>拉取远程分支到本地(方式二)</h4>
<pre><code>git fetch origin ac_branch:ac_branch</code></pre>
<p>方式二做了三件事:</p>
<p>1、同步远程仓库(git fetch origin)
2、拉取远程分支到本地
3、在本地创建一个分支与远程分支对应</p>