[英]merge a branch into a new sub directory on the master
我有一個帶有 master 和 feature 分支的倉庫。 我想知道是否有辦法將功能分支合並為主分支下的新子目錄。
謝謝!
git am
有一個--directory=<dir>
開關,所以你告訴你使用哪個目錄作為應用補丁的基礎。
所以,首先制作一個git format-patch
然后應用它們:
$ git checkout master
$ git format-patch -o ../patches/ master..feature-branch
$ git am --directory=feature-subdir ../patches/*
--directory=<dir>
由git am
傳遞給git apply
。 從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.
是的你可以。 只需將功能分支的內容移動到一個目錄,然后將其與master合並。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.