7

I forked a repository as a starting point for a new project, never intending to submit pull requests to the original repo. It's become annoying to have to select my own master branch every time I want to merge a branch in the GitHub interface.

How can I remove the reference to the upstream so that my own master branch will be automatically selected when creating merge requests?

I tried editing .git/config as suggested here, but my config file does not include any reference to the upstream.

2
  • Can you use git?
    – AccioBooks
    Feb 9, 2016 at 19:39
  • You mean to do the merges? I'm sure I could, though I'd prefer to remove the upstream as I'm afraid a fellow developer may someday accidentally send a pull request to the wrong place. Feb 9, 2016 at 19:42

2 Answers 2

5

Unfortunately, it doesn't seem to be possible. However, for a small project like mine, I was able to go with the less-than-ideal solution without too much pain:

  1. Make sure your local copy of the repo is up-to-date.
  2. Take a screen shot of, or otherwise note, open issues currently in the repo.
  3. Delete the repo on GitHub.
  4. Create a new repo on GitHub with the same name.
  5. In your local copy, modify the old remote to point to the new GitHub repo.
  6. Re-add issues, collaborators, etc, as needed.
4
git remote rm upstream

Just discovered this by plugging-n-chugging. This is the command that removes the specified upstream.

Make sure to verify that the old upstream has been removed:

git remote -v

Anything marked with "upstream" should have been removed.

Now you can simply add a new upstream and start over (an example for Github):

git remote add upstream https://github.com/USERNAME/wellmap.github.io

Hope I helped!

2
  • Good tip! Unless I'm missing something, it looks like this removes the remote locally, but the upstream is still retained on GitHub. Jul 23, 2020 at 16:00
  • 1
    @Nathan Arthur yes, you are right. GitHub retains the repo but your local git basically untracks and effectively deletes the upstream when you run the "rm" command -- from my best understandkmg Jul 24, 2020 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.