问题
Steps already taken
- I found a github repository from user X
- I clicked "open in visual studio"
- I made some changes and did a commit. It committed to my local repository.
- I installed github extension for Visual Studio 2017
- 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:
When I tried to push to my fork on Github:
I got this:
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:
I think you did it wrong way.
How contribute to GitHub repo:
Fork GutHub repo, you get fork of this pero in your GitHub account
Clone your fork (just clicking open in VS)
- Commit into your local repo
- Push to your fork
- Create pull request from your fork
See guide here.
What you can do in your current situation:
- Push from your local repo to your fork (you need to change remote of your local repo)
- create pull request from fork.
or
- Clone your fork (open in VS)
- Merge it with you local repo, when you have commits
- Push to your GitHub fork
- Create pull request from fork.
How to change remote of you local repo in VS:
- In Team Explorer tab go to Home:
- Go to Settings:
- Repository Settings => Remotes:
When you do push, you can choose to which remote push:
Comment: instead adding remotes for you local repo, you can just change origin to your fork, where you need to push.
来源:https://stackoverflow.com/questions/46270203/how-to-do-a-pull-request-from-my-current-state