diff options
author | Alyssa Rosenzweig <alyssa@rosenzweig.io> | 2017-03-17 23:50:52 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <alyssa@rosenzweig.io> | 2017-03-17 23:50:52 -0700 |
commit | dd3a800d82e0b9a4f1a785d61fd17fa202cb0e2c (patch) | |
tree | 091cb7de98272ff37354fb4ebcd5a47b9e7180a1 /docs/misc/patch.md | |
parent | 14ac959780ab3dc09559a17d4c12b7fd3705be6f (diff) | |
download | librebootfr-dd3a800d82e0b9a4f1a785d61fd17fa202cb0e2c.tar.gz librebootfr-dd3a800d82e0b9a4f1a785d61fd17fa202cb0e2c.zip |
I can escape good
Diffstat (limited to 'docs/misc/patch.md')
-rw-r--r-- | docs/misc/patch.md | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/docs/misc/patch.md b/docs/misc/patch.md index 6164986c..318c7428 100644 --- a/docs/misc/patch.md +++ b/docs/misc/patch.md @@ -9,12 +9,12 @@ Apply a patch To apply a patch to a single file, do that in it's directory: - \$ patch < foo.patch + $ patch < foo.patch Assuming that the patch is distributed in unified format identifying the file the patch should be applied to, the above will work. Otherwise: - \$ patch foo.txt < bar.patch + $ patch foo.txt < bar.patch You can apply a patch to an entire directory, but note the "p level". What this means is that inside patch files will be the files that you @@ -24,7 +24,7 @@ where the patch was created. 'p' level instructs the 'patch' utility to ignore parts of the path name to identify the files correctly. Usually a p level of 1 will work, so you would use: - \$ patch -p1 < baz.patch + $ patch -p1 < baz.patch Change to the top level directory before running this. If a patch level of 1 cannot identify the files to patch, then inspect the patch file for @@ -34,7 +34,7 @@ file names. For example: and you are working in a directory that contains panic/yet.c, use: - \$ patch -p5 < baz.patch + $ patch -p5 < baz.patch You usually count one up for each path separator (forward slash) removed from the beginning of the path, until you are left with a path that @@ -42,7 +42,7 @@ exists in the current working directory. The count is the p level. Removing a patch using the -R flag - \$ patch -p5 -R < baz.patch + $ patch -p5 -R < baz.patch [Back to top of page.](#pagetop) @@ -51,15 +51,15 @@ Create a patch with diff Diff can create a patch for a single file: - \$ diff -u original.c new.c > original.patch + $ diff -u original.c new.c > original.patch For diff'ing a source tree: - \$ cp -R original new + $ cp -R original new Do whatever you want in new/ and then diff it: - \$ diff -rupN original/ new/ > original.patch + $ diff -rupN original/ new/ > original.patch [Back to top of page.](#pagetop) @@ -72,15 +72,15 @@ Note: this won't show new files created. Just make whatever changes you want to a git clone and then: - \$ git diff > patch.git + $ git diff > patch.git Note the git revision that you did this with: - \$ git log + $ git log Alternatively (better yet), commit your changes and then use: - \$ git format-patch -N + $ git format-patch -N Replace N with the number of commits that you want to show. [Back to top of page.](#pagetop) @@ -93,11 +93,11 @@ it really is. Now to apply that patch in the future, just git clone it again and do with the git revision you found from above: - \$ git reset \--hard REVISIONNUMBER + $ git reset \--hard REVISIONNUMBER Now put patch.git in the git clone directory and do: - \$ git apply patch.git + $ git apply patch.git If you use a patch from git format-patch, then use **git am patch.git** instead of **git apply patch.git**. git-am will re-create the commits |