企业开发中,经常会单独拉分支去做自己的需求开发,但是某些时候一些公共的配置我们需要从主线pull
,这时候整个分支merge
显然不合适
1.切换至待合并文件的分支
git checkout <branch>
2.将目标分支的单个文件合并到当前分支
git checkout <目标分支> -- <文件路径>
3.提交合并后的更改
git add <文件路径>
git commit -m "合并单个文件到目标分支的描述"
4.其他命令
git branch
git stash
git stash pop