Reputation: 2711
I am working on this public repository called tallyfor/flow. As you see, it is a fork of nodename/flow which in turn is a fork of the original fmnoise/flow.
Locally, I created a branch called
add-ci-to-automatically-publish-packages
and added a ci.yml
file
(Continuous Integration effort).
After executing the command below to create a Pull Request:
git push origin add-ci-to-automatically-publish-packages
Things seemed to be correct about the "address" where the Push would go:
~/projects/flow on add-ci-to-automatically-publish-packages
ā git remote -v
origin [email protected]:tallyfor/flow.git (fetch)
origin [email protected]:tallyfor/flow.git (push)
However, something weird happens, since my Pull Request does not go to the expected repository. Instead of going to tallyfow/flow, the Pull Request goes to nodename/flow - see the PR here.
Why does this happen? How can I make the changes on tallyfor/flow?
Upvotes: 1
Views: 755
Reputation: 489588
It seems likely that you're using one of the automated setups, where you (or someone you work with) has set things up so that your git push
to your fork triggers a GitHub Action that creates a PR from your fork to its upstream. That's not something Git does, that's something GitHub is doing. If you don't want it to do that, stop telling it to do that. š
The git push
command does not, in and of itself, create a pull request. It literally can't, as Git knows nothing about pull requests. Pull requests are a GitHub feature, not a Git feature.
If you so desire, you can set up a GitHub repository so that pushing to particular branch names automatically creates a pull request. This does not happen because of the git push
itself but rather because of a GitHub Action that you install. For further information about this, see Create Pull Request on Git Push.
When you create a GitHub Pull Request using the GitHub web interface or the github-cli gh
command, you choose where the PR goes. If you've forked a fork, the default is for your PR to go to the fork you forked, not the original fork. To redirect the GitHub PR elsewhere you must use GitHub's "compare across forks" option, as described on the GitHub help pages.
I'm sure it's possible to combine these, so that a push to a fork of a fork can automatically create a PR to the original repository. I think this is what is happening here.
Upvotes: 2