-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatch
30 lines (21 loc) · 892 Bytes
/
patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Patch a file (or files) with a diff file.
# Note that diff files should be generated by the `diff` command.
# Apply a patch using a diff file (filenames must be included in the diff file)
patch < $patch_file
# Apply a patch to the current directory. (filenames must be included in the diff file)
patch -p0 < $patch_file
# Apply a patch to the current directory. (filenames must be included in the diff file)
patch -p1 < $patch_file
# Apply a patch to a specific file:
patch $input_file < $patch_file
# Patch a file writing the result to a different file:
patch $input_file -o $output_file < $patch_file
# To reverse a patch:
patch -R $input_file < $patch_file
# patch with git diff file (dry-run for checking)
git apply --check $git_diff_file
# patch with git diff file
git apply $git_diff_file
# apply git patch which generated by git format-patch
git am patch/*
# vim: set ft=sh