0

I want to create a branch in GIT with the file differences from 2 other git branches. I do not want whole repo copy but only the changed files keeping rest of the folder structure as is. How can I achieve this?

For example:

Branch 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

Branch 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

New branch should have:

deployment/src/main/apiproxy/myorg/folder1/file1.txt
deployment/src/main/apiproxy/myorg/folder2/file2.txt
max630
  • 8,762
  • 3
  • 30
  • 55
Tarun
  • 35
  • 1
  • 1
  • 6

1 Answers1

0

Instead of creating a new branch, You can just create a patch for the changes.

git format-patch testbranch2 --stdout > mypatch.patch

Later if you need to apply your patch, do the following.

git apply mypatch.patch
Md. Al-Amin
  • 1,423
  • 1
  • 13
  • 26