GIT A分支的改动合并到B分支,不合并commit

39 阅读1分钟

切到对应分支

git checkout func_A_branch

拉取最新代码

git pull --rebase

HEAD 比 origin/master 的变更代码,并记录到 /tmp/diff.patch 文件

git diff  origin/master HEAD > /tmp/diff.patch

拉取新分支

git checkout master
git status
git pull --rebase
git checkout -b func_B_branch
git reset --hard origin/master

应用 /tmp/diff.patch 的改动记录

git apply /tmp/diff.patch