我想在GIT中创建一个分支,其中包含与其他2个git分支的文件差异。我不希望整个repo副本,但只有更改的文件保持文件夹结构的其余部分。我怎样才能做到这一点?
例如:
分支1:testbranch1
deployment/src/main/apiproxy/myorg/folder1/file1.txt
deployment/src/main/apiproxy/myorg/folder1/file2.txt
deployment/src/main/apiproxy/myorg/folder2/file1.txt
deployment/src/main/apiproxy/myorg/folder2/file2.txt
分支2:testbranch2
deployment/src/main/apiproxy/myorg/folder1/file1.txt -> File Changed
deployment/src/main/apiproxy/myorg/folder1/file2.txt
deployment/src/main/apiproxy/myorg/folder2/file1.txt
deployment/src/main/apiproxy/myorg/folder2/file2.txt -> File Changed
新分支应该有:
deployment/src/main/apiproxy/myorg/folder1/file1.txt
deployment/src/main/apiproxy/myorg/folder2/file2.txt
答案 0 :(得分:0)
您可以只为更改创建补丁,而不是创建新分支。
git format-patch testbranch2 --stdout > mypatch.patch
稍后,如果您需要应用修补程序,请执行以下操作。
git apply mypatch.patch