I have a patch that contains a lot of changes that I would like to split into multiple commits and potentially modify some of the changes.
I want to apply this patch to
Try this command line
git am < patchname.patch
You can use git apply which applies a patch:
git apply < patchname.patch
This does not create any commits. In fact, without any options the git apply
command doesn't even need to have a Git repository. It just applies patches to files.
You can use a patch
command, e.g.:
patch -p1 < path/file.patch
When using patch
command, it will usually auto-detect the format. This is useful when you're trying to apply patch to the working directory which isn't a local checkout of the project you wish to patch.
Otherwise use git apply
if your patch was created specifically for the project, otherwise it will fail to do anything when used within a local checkout of a git repository.