gpt4 book ai didi

git - 将分支 merge 到 master 上的新子目录中

转载 作者:行者123 更新时间:2023-12-05 04:18:30 24 4
gpt4 key购买 nike

我有一个包含 master 和 feature 分支的 repo。我想知道有没有办法将feature分支 merge 为master分支下的新子目录。

谢谢!

最佳答案

git am有一个 --directory=<dir> switch,这样你就可以知道使用哪个目录作为应用补丁的基础。

所以,首先制作一个git format-patch然后应用它们:

$ git checkout master
$ git format-patch -o ../patches/ master..feature-branch
$ git am --directory=feature-subdir ../patches/*

--directory=<dir>传递给 git apply通过 git am .来自 git help apply :

   --directory=<root>
Prepend <root> to all filenames. If a "-p" argument was also passed, it is applied before prepending the new root.

For example, a patch that talks about updating a/git-gui.sh to b/git-gui.sh can be applied to the file in the working tree modules/git-gui/git-gui.sh by running git apply
--directory=modules/git-gui.

关于git - 将分支 merge 到 master 上的新子目录中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13500294/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com