Merge a GitHub Pull Request to Local Repo
When we need to test a PR in github or we want to incorporate a PR, we can checkout the PR locally.
To check out a pull request locally, use the gh pr checkout subcommand. Replace pull-request with the number, URL, or head branch of the pull request.
gh pr checkout {pull-request#}
Related cards:
Apply Upstream Pull Request to Local
There are 2 ways:
Using GitHub CLI gh
If local branch has the same base branch as upstream:
gh PR checkout {PR#}
Using Patch Files
If local branch diverges from the branch in which the PR is based, then we need to create patc...
How to Contribute to Open Source Project in GitHub
We use a process called pull request, or PR for short, to contribute to open source.
Prerequisites
We need a fork repo in our GitHub account and in our local machine. See this [guide](https://makandracards.com/kiat_git/68235-how-to-update-a-...
How to Update a Forked Repository from Upstream
Scenario
2 to 3 remote repositories in GitHub and 2 local repositories:
- [GitHub] Go to an owner repository (eg OpenMage).
- [GitHub] Fork owner's repository (from item 1).
- [GitHub or BitBucket] Our application with custom code.
- [Loca...
Create local repository and push to remote
Create Local Repository
- Download GitHub for Windows or use something similar, which includes a shell
- Launch Git Shell
- In the shell, navigate to the directory with
cd
-
git init
to create a local repository
...
How to create new repo on existing code and link to remote
I wrote some code in some files in a folder called AA. I have a repo in remote in Bitbucket. Here're the steps to link my local to remote using TortoiseGit:
- Create a repo for the folder AA: Navigate to the folder in windows explorer and ri...
Deprecated - How to Remove Unwanted Files Before Merging an Upstream Branch to Master and Staging
Deprecated method. Use this instead. See also [this](https://makandracards.com/kiat_git/485037-how-to-r...
How to Rebase to Another Branch in GitHUb
For examples,
- There are recent commits to branch A, but the commits should have been in branch B. To fix this, in branch A, use TortoiseGit to rebase to branch B.
- There is a new default branch called
main
but your PR was based on an olde...
[deprecated] How to remove tracked files in upstream before updating our sites
Better way is use .gitattributes
, see Merge Strategies
Use Case
If we use an open source in our project, e.g. [OpenMage](https://github.com/OpenMage/magento-l...
How to migrate to Magento LTS with git with combined histories
Scenario
Magento 1 is end of life. I want to migrate an existing Mage repo to the latest from Magento - Long Term Support maintained by OpenMage .
Warning: the follow...
How to check compare changes on a topic branch to master
If I want to compare changes on a topic branch to master, I find it easiest and safest to do the following:
git checkout master
git checkout -b trial_merge
git merge topic_branch
After completing the merge, it is easy to see the cons...