#TIL 42 - Cherry pick from pull request
How to cherry pick from pull request
Installation
Use Homebrew to install hub
on macOS:
brew install hub
Configuration
After installing, configure hub
to work with GitHub by editing the ~/.config/hub
file.
-
Create or Edit the Configuration File:
vi ~/.config/hub # You can use any text editor
-
Add Your Configuration:
github.com: - user: YOUR_USERNAME oauth_token: ghp_YOUR_TOKEN protocol: https
-
Save and Exit the text editor.
Cherry pick from pull request
Use hub am
Command: To apply the changes from a specific GitHub pull request to your local branch, use the following command:
hub am -3 GITHUB-URL
Here, -3
is recommended for three-way merging and GITHUB-URL
is the URL of the pull request or commit you want to apply.
This will download the pull request's patch to a temporary location and then use git am
to apply it to your local branch.
Hope this provides a concise and informative explanation.