请帮助我解决以下问题。 我在GIT回购中有两个分支A和B.现在这两个分支都有两个文件夹Folder1和Folder2。 现在我已经更改了分支B的两个文件夹中的一些文件,并且我在一次提交中提交了所有更改,并将更改也推送到了分支B.现在我想将Folder1从分支B到分支A的更改,但不是对来自B的Folder2的更改。如何在GIT中将B合并到A,这样只有Folder1从B的更改才会合并到A的Folder1。
此致 杜
答案 0 :(得分:0)
假设提交是abc123
。
#switch to A
git checkout A
#apply abc123's changes to A but not commit them
git cherry-pick abc123 -n
#commit the changes of Folder1
git commit -- Folder1
#discard the changes of Folder2
git reset HEAD -- Folder2
git checkout -- Folder2