

gh pr checkout | GitHub CLI
source link: https://cli.github.com/manual/gh_pr_checkout?WT_mc_id=-blog-scottha
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

gh pr checkout
Check out a pull request in git
gh pr checkout {<number> | <url> | <branch>} [flags]
Options
--detach Checkout PR with a detached HEAD
-f, --force Reset the existing local branch to the latest state of the pull request
--recurse-submodules Update all submodules after checkout
Options inherited from parent commands
--help Show help for command
-R, --repo [HOST/]OWNER/REPO Select another repository using the [HOST/]OWNER/REPO format
In use
Using pull request number
You can check out any pull request, including from forks, in a repository using its pull request number
// Checking out a pull request locally
~/Projects/my-project$ gh pr checkout 12
remote: Enumerating objects: 66, done.
remote: Counting objects: 100% (66/66), done.
remote: Total 83 (delta 66), reused 66 (delta 66), pack-reused 17
Unpacking objects: 100% (83/83), done.
From https://github.com/owner/repo
* [new ref] refs/pull/8896/head -> patch-2
M README.md
Switched to branch 'patch-2'
~/Projects/my-project$
Using other selectors
You can also use URLs and branch names to checkout pull requests.
// Checking out a pull request locally
~/Projects/my-project$ gh pr checkout branch-name
Switched to branch 'branch-name'
Your branch is up to date with 'origin/branch-name'.
Already up to date.
~/Projects/my-project$
Recommend
-
139
Clean Checkout for Magento 2 A drop-in replacement for the Magento 2 checkout. Features Modules The project is divided into several modules: Overall checkout improvements, such as; (
-
112
sdras/sample-stripe-handler master
-
74
From my understanding about git, every time I perform a git checkout one of two things happens:The branch already exists locally and so the HEAD is simply positioned on the top of it.The branch ...
-
65
GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85 million projects.
-
25
README.md REST API SDK for PHP V2
-
19
Bring your monorepo down to size with sparse-checkout This post was written by Derrick Stolee
-
4
-
9
Checkout a GitHub Pull Request If you work with a lot of open source projects, you may find a need to modify a GitHub Pull Request before merging to the master branch. This may be because you need to rebase, fix a failing test, or reso...
-
11
GitHub Checkout Action Preserve File Modification Time 2022-05-15...
-
3
PayPal Streamlines Checkout Integration Workflows with GitHub Codespaces
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK