赞
踩
git checkout 来源分支 -- 文件路径
例如我想 将master
分支上的utils
文件夹复制到 work
分支
git checkout master -- utils
#切换到work分支 $ git checkout work Switched to branch 'work' #将master上的utils文件夹复制到work分支 $ git checkout master -- utils #保存修改 $ git add utils #提交修改 $ git commit -m "Adding 'utils' directory from 'master' branch." [work 9fcd968] Adding 'utils' directory from 'master' branch. 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 utils/file
#切换到master分支
$ git checkout master
Switched to branch 'master'
#递归删除utils目录
$ git rm -r utils
rm 'utils/file'
#提交
$ git commit -m "Removing 'utils' directory."
[master c786f95] Removing 'utils' directory.
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 utils/file
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。