- Add the github or gitlab repo as a remote and cherry-pick the PR on top. Good for large PRs with multiple commits that you may wish to apply independently or omit completely.
- Use curl to download the patch file from the PR. Good for small PRs!
Find the katello source code location and cd into it:
rpm -ql tfm-rubygem-katello | head
cd /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1.31
Initialize a git repository so it's easy to revert code changes
git init
git add -A
git commit -m "initial"
git remote add upstream https://github.com/katello/katello
git fetch upstream pull/PULL_REQUEST_ID/head:SOME_LOCAL_BRANCH_NAME
cherry-pick the code change onto the working branch:
git cherry-pick SOME_LOCAL_BRANCH_NAME
You may need to resolve merge conflicts. Ignore any test/ files - they aren't going to affect anything.
Restart the server to make the changes visible:
systemctl restart httpd foreman smart_proxy_dynflow_core
curl -skiL https://github.com/Katello/katello/pull/9467.patch -o 9467.patch
git apply --reject --whitespace=fix 9467.patch
Any merge conflicts will be created in files with the .rej extension. Resolve them manually.
Another alternative is to download the raw file directly from the PR and put them in the right place with curl. Good for single-file changes. The URL is taken from the Files view on the PR, viewing the individual file, and pressing the 'Raw' button.
https://raw.githubusercontent.com/Katello/katello/ec40908addd2d0befc53e6d2d6220e6a2a503e06/app/lib/actions/candlepin/environment/create.rb -o app/lib/actions/candlepin/environment/create.rb
Restart the server to make the changes visible
systemctl restart foreman httpd smart_proxy_dynflow_core