Question

I created my private & local repository using git clone --bare $upstream (detailed here How to create a git repository on my server from the github server?)

At that time, I didn't think I will be contributing to the original github repo. ($upstream)
And I found out that pull requests is only possible from github repository.

So my question is How can I contribute to the original github repo?

I wonder if following strategy is possible:

  1. I create a github fork from $upstream (the original opensource github repo)
  2. somehow teach my local repo about the new github fork(as I did git remote add)
  3. create a branch(MyWork) on my local clone, work, and push to the new github fork
  4. pull requests to original repo auther.

Edit

Since there are many modifications(commits) in my private repo,
I need a way to go to the current $upstream's clean state(upstream's master without my local modification which I made in my origin/master , not in MyWork).

(So that my pull request doesn't have my modification except the branch(for pull request))

How can I do that?

Was it helpful?

Solution

took me a long time to figure it out..
There's a cherry-pick command in git which is perfect for my situation.

Send a pull request on GitHub for only latest commit

basically,

git checkout -b MyWork_for_pull_request upstream/master (make branch off upstream/master not origin/master)
git cherry-pick `sha-of-MyWork-branch's-commit` (pick out commits I want to contribute)
git push mygithub_fork MyWork_for_pull_request

and press pull request in the github page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top