删除本地分支,并从新拉取远程分支复制到本地

1. 删除本地分支git

假设想要删除本地的分支temp,而且当前处在temp分支上,首先须要切换到别的分支(假设切换到develop分支):fetch

git checkout develop  //切换到develop分支

git branch  //此时处在develop分支

git branch -D temp  //删除本地temp分支

 

2.从新拉取远程仓库代码,并自动建立分支spa

git fetch 会将远程代码的更新(commit)拉取到本地。code

git fetch origin temp:temp  //拉取远程库temp分支的代码到本地的temp分支,若是不存在temp分支,将自动建立temp分支
git fetch <远程主机名>  //将远程库的更新(commit)拉取到本地
git fetch <远程主机名> <分支名>  //将远程库的<分支名>的分支拉取到本地
相关文章
相关标签/搜索