How to do a pull request from my current state

2019-07-09 14:49发布

Steps already taken

  1. I found a github repository from user X
  2. I clicked "open in visual studio"
  3. I made some changes and did a commit. It committed to my local repository.
  4. I installed github extension for Visual Studio 2017
  5. I created a fork in my own github repository directly from user X's repository.

Question

I want my changes to appear as a pull request in the repository of user X.

What are the exact steps in Visual Studio (not command line) that I need to take to do that, given where I am now?

More info

I don't have or want any permissions in this github repository of user X. It probably involves doing a pull request from a fork. I guess what I can't seem to figure out is how to get my changes into my fork that I made. Once it's there, I think I know how to create a pull request in user X's repository from my fork. My github extension only mentions his repository and therefore I can't push my changes into my fork.

Update: Pushing to my fork fails

My remotes:

enter image description here

When I tried to push to my fork on Github:

enter image description here

I got this:

enter image description here

My fork on Github doesn't have any branches (that I own (under the "Yours" tab)). So the push fails. But I need to successfully do a push to get a branch, right? Seems like a catch 22.

1条回答
劳资没心,怎么记你
2楼-- · 2019-07-09 15:15

I think you did it wrong way.

How contribute to GitHub repo:

  1. Fork GutHub repo, you get fork of this pero in your GitHub account

  2. Clone your fork (just clicking open in VS)

  3. Commit into your local repo
  4. Push to your fork
  5. Create pull request from your fork

See guide here.

What you can do in your current situation:

  1. Push from your local repo to your fork (you need to change remote of your local repo)
  2. create pull request from fork.

or

  1. Clone your fork (open in VS)
  2. Merge it with you local repo, when you have commits
  3. Push to your GitHub fork
  4. Create pull request from fork.

How to change remote of you local repo in VS:

  1. In Team Explorer tab go to Home:

enter image description here

  1. Go to Settings:

enter image description here

  1. Repository Settings => Remotes:

enter image description here

When you do push, you can choose to which remote push:

enter image description here

Comment: instead adding remotes for you local repo, you can just change origin to your fork, where you need to push.

查看更多
登录 后发表回答