分为三个步骤 1.将在错误分支开发的代码放到暂存区 git命令: git stash 2.切换到需要开发的分支 git命令: 略 本人直接idea切换。 3.取出暂存区的代码 git命令: git stash apply 搞定!!!!