Andreas Höhmann
Andreas Höhmann

Reputation: 93

Create git patch per changed file in a branch

I want create a list of patches where each patch contains the changes for that particular file in the branch against the "up-stream" (to the time where I create the branch from the up-stream) ... I want see a list like this:

changed-file-foo.java.patch
changed-path__file-foo.java.patch
changed-path_subpath_file-foo.java.patch
...

Upvotes: 0

Views: 47

Answers (1)

Jesferman
Jesferman

Reputation: 1084

If you are using bash, do:

for f in $(find . ! -path "./.git/*"); do git diff branch1 branch2 -- $f > $f.patch; done

It goes through all files of your current directory except /.git/ that is not useful for creating patches

Upvotes: 1

Related Questions