-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explain how to work with patches #3580
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,46 @@ We do not capitalize the following terms: | |
* Red Hat subscription manifest | ||
* subscription | ||
|
||
## Working with patches | ||
|
||
You can create patches to simplify sharing proposed changes compared to comments and suggestions on GitHub. | ||
|
||
### Creating patches | ||
|
||
1. Fetch the PR from GitHub: | ||
|
||
$ git fetch upstream pull/1234/head:pr_1234_optional_description | ||
|
||
2. Make your changes and commit them: | ||
|
||
$ vim guides/common/modules/X | ||
$ git add guides/common/modules/X | ||
$ git commit -m "Proposed patch" | ||
|
||
3. View the patch: | ||
|
||
$ git show | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's also $ gh pr checkout 3580
From https://github.com/theforeman/foreman-documentation
* [new ref] refs/pull/3580/head -> how-to-apply-patch
Switched to branch 'how-to-apply-patch'
$ vi CONTRIBUTING.md
$ git commit -am 'Use gh pr checkout'
[how-to-apply-patch 2a8be45942a4] Use gh pr checkout
1 file changed, 2 insertions(+), 2 deletions(-)
$ git status
On branch how-to-apply-patch
Your branch is ahead of 'upstream/pr/3580' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
$ git format-patch upstream/pr/3580
0001-Use-gh-pr-checkout.patch And you have a regular file (or files in case of multiple commits) |
||
|
||
4. Email that patch or post it on GitHub. | ||
|
||
### Applying patches | ||
|
||
1. Store the patch in your `foreman-documentation` repository. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically the location doesn't matter so you can say |
||
2. Apply the patch: | ||
|
||
$ git apply proposed.patch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you used |
||
|
||
3. Delete the file: | ||
|
||
$ rm proposed.patch | ||
|
||
4. Commit the patch to your branch: | ||
|
||
$ git add guides/common/modules/X | ||
$ git commit -m "Proposed patch" | ||
|
||
To be extra nice, credit the person that provided the patch in the commit message. | ||
Comment on lines
+121
to
+126
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As noted before, when using |
||
|
||
## Further Information | ||
|
||
* [Contributing Guidelines for Github documentation](https://github.com/github/docs/blob/main/CONTRIBUTING.md) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With https://cli.github.com/ you can do
gh pr checkout 1234
to check out a PR